diff options
Diffstat (limited to 'source/slang/slang-ast-decl.h')
| -rw-r--r-- | source/slang/slang-ast-decl.h | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/source/slang/slang-ast-decl.h b/source/slang/slang-ast-decl.h index c46878945..a92f73e2a 100644 --- a/source/slang/slang-ast-decl.h +++ b/source/slang/slang-ast-decl.h @@ -4,6 +4,7 @@ #include "slang-ast-base.h" #include "slang-ast-decl.h.fiddle" +#include "slang-fossil.h" FIDDLE() namespace Slang @@ -34,23 +35,54 @@ class UnresolvedDecl : public Decl struct ContainerDeclDirectMemberDecls { public: - List<Decl*> const& getDecls() const { return decls; } + List<Decl*> const& getDecls() const; - List<Decl*>& _refDecls() { return decls; } + Count getDeclCount() const; + Decl* getDecl(Index index) const; + + Decl* findLastDeclOfName(Name* name) const; + + Dictionary<Name*, Decl*> getMapFromNameToLastDeclOfThatName() const; + + List<Decl*> const& getTransparentDecls() const; + + bool isUsingOnDemandDeserialization() const; + + void _initForOnDemandDeserialization( + RefObject* deserializationContext, + void const* deserializationData, + Count declCount); private: friend class ContainerDecl; + friend class ModuleDecl; friend struct ASTDumpContext; - List<Decl*> decls; + bool _areLookupAcceleratorsValid() const; + void _invalidateLookupAccelerators() const; + void _ensureLookupAcceleratorsAreValid() const; + + void _readSerializedTransparentDecls() const; + Decl* _readSerializedDeclAtIndex(Index index) const; + Decl* _readSerializedDeclsOfName(Name* name) const; + + void _readAllSerializedDecls() const; + + mutable List<Decl*> decls; - struct + mutable struct { Count declCountWhenLastUpdated = 0; Dictionary<Name*, Decl*> mapNameToLastDeclOfThatName; List<Decl*> filteredListOfTransparentDecls; } accelerators; + + mutable struct + { + RefPtr<RefObject> context; + void const* data = nullptr; + } onDemandDeserialization; }; /// A conceptual list of declarations of the same name, in the same container. @@ -199,6 +231,10 @@ class ContainerDecl : public Decl // void addMember(Decl* member) { addDirectMemberDecl(member); } + /// Is this declaration using on-demand deserialization for its direct members? + /// + bool isUsingOnDemandDeserializationForDirectMembers(); + // // NOTE: The operations after this point are *not* considered part of // the public API of `ContainerDecl`, and new code should not be @@ -737,6 +773,14 @@ class ModuleDecl : public NamespaceDeclBase /// This mapping is filled in during semantic checking, as `ExtensionDecl`s get checked. /// FIDDLE() Dictionary<AggTypeDecl*, RefPtr<CandidateExtensionList>> mapTypeToCandidateExtensions; + + /// Is this module using on-demand deserialization for its exports? + /// + bool isUsingOnDemandDeserializationForExports(); + + /// Find a declaration exported from this module by its `mangledName`. + /// + Decl* _findSerializedDeclByMangledExportName(UnownedStringSlice const& mangledName); }; // Represents a transparent scope of declarations that are defined in a single source file. |
