summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 4f057bb21..3a11d3831 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -2980,17 +2980,22 @@ RefPtr<Module> Linkage::loadModule(
// Create an artifact for the source
auto sourceArtifact = ArtifactUtil::createArtifact(ArtifactDesc::make(ArtifactKind::Source, ArtifactPayload::Slang, ArtifactStyle::Unknown));
- // Create with the 'friendly' name
- if (filePathInfo.type == PathInfo::Type::Normal ||
+ if (sourceBlob)
+ {
+ // If the user has already provided a source blob, use that.
+ sourceArtifact->addRepresentation(new SourceBlobWithPathInfoArtifactRepresentation(filePathInfo, sourceBlob));
+ }
+ else if (
+ filePathInfo.type == PathInfo::Type::Normal ||
filePathInfo.type == PathInfo::Type::FoundPath)
{
+ // Create with the 'friendly' name
// We create that it was loaded from the file system
sourceArtifact->addRepresentation(new ExtFileArtifactRepresentation(filePathInfo.foundPath.getUnownedSlice(), getFileSystemExt()));
}
else
{
- // Else we say we don't know and just add the blob
- sourceArtifact->addRepresentationUnknown(sourceBlob);
+ return nullptr;
}
translationUnit->addSourceArtifact(sourceArtifact);