From eda9dd33647b271dd5ea5256e87cb23ad269b19f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 12 Apr 2023 12:06:41 -0400 Subject: 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. --- source/compiler-core/slang-artifact-handler-impl.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source/compiler-core/slang-artifact-handler-impl.cpp') 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) -- cgit v1.2.3