summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-28 15:09:19 -0800
committerGitHub <noreply@github.com>2023-02-28 15:09:19 -0800
commitf7db44a236bb867003395d1a91d6907901653528 (patch)
tree84d65caea539337bf19fb4435a1fe6fa5de589fb /source/slang/slang.cpp
parentf23e36243e9c59c02f66ec2e18b80ba4ea540f45 (diff)
Add `SourceBlobWithPathInfoArtifactRepresentation`. (#2682)
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);