summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-artifact-handler-impl.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-04-12 12:06:41 -0400
committerGitHub <noreply@github.com>2023-04-12 12:06:41 -0400
commiteda9dd33647b271dd5ea5256e87cb23ad269b19f (patch)
treefb869c983b5eda00794606caeb6334ac176d359a /source/compiler-core/slang-artifact-handler-impl.cpp
parent4e9ca28a71dca90e19a15b2103bdc3d0db6ffd9c (diff)
Artifact Container (#2783)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP simplifying artifact interface. * Use ContainedKind. * Remove LazyCastableList. Use ContainedKind for find. * Remove ICastableList. * Remove need for ICastableList. * Remove IArtifactContainer. * Small fixes. * Small improvements around Artifact. * Make explicit find is for *representations* that can cast. Fix bug in handling casting in lookup. * Made associated items artifacts too. * Small fixes. * Small improvements around writing a container. * WIP artifact container format. * Make the root a special case. * Special case if the artifact doesn't have children/associated.
Diffstat (limited to 'source/compiler-core/slang-artifact-handler-impl.cpp')
-rw-r--r--source/compiler-core/slang-artifact-handler-impl.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/compiler-core/slang-artifact-handler-impl.cpp b/source/compiler-core/slang-artifact-handler-impl.cpp
index 1b71dbf59..eb5bfc64a 100644
--- a/source/compiler-core/slang-artifact-handler-impl.cpp
+++ b/source/compiler-core/slang-artifact-handler-impl.cpp
@@ -105,15 +105,25 @@ SlangResult DefaultArtifactHandler::expandChildren(IArtifact* container)
// For the generic container type, we just expand as empty
const auto desc = container->getDesc();
- if (desc.kind == ArtifactKind::Container)
+ if (desc.kind == ArtifactKind::Container)
+ {
+ // If it's just a generic container, we can assume it's expanded, and be done
+ return SLANG_OK;
+ }
+
+ if (isDerivedFrom(desc.kind, ArtifactKind::Container))
{
+ // TODO(JS):
+ // Proper implementation should (for example) be able to expand a Zip file etc.
+
+ // For now we just set that there are no children, and be done
container->setChildren(nullptr, 0);
- return SLANG_OK;
+ return SLANG_E_NOT_IMPLEMENTED;
}
- // TODO(JS):
- // Proper implementation should (for example) be able to expand a Zip file etc.
- return SLANG_E_NOT_IMPLEMENTED;
+ // We can't expand non container like types, so we just make sure it's empty
+ container->setChildren(nullptr, 0);
+ return SLANG_OK;
}
SlangResult DefaultArtifactHandler::getOrCreateRepresentation(IArtifact* artifact, const Guid& guid, ArtifactKeep keep, ICastable** outCastable)