summaryrefslogtreecommitdiff
path: root/src/core/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model')
-rw-r--r--src/core/model/Typesystem.cpp6
-rw-r--r--src/core/model/Typesystem.hpp22
2 files changed, 25 insertions, 3 deletions
diff --git a/src/core/model/Typesystem.cpp b/src/core/model/Typesystem.cpp
index 2be564d..6daa7fe 100644
--- a/src/core/model/Typesystem.cpp
+++ b/src/core/model/Typesystem.cpp
@@ -526,6 +526,7 @@ void Typesystem::doResolve(ResolutionState &state)
{
continueResolveComposita(constants, constants.getIndex(), state);
continueResolveComposita(types, constants.getIndex(), state);
+ continueResolveReferences(typesystems, state);
}
bool Typesystem::doValidate(Logger &logger) const
@@ -542,6 +543,11 @@ Rooted<StructType> Typesystem::createStructType(const std::string &name)
return structType;
}
+void Typesystem::includeTypesystem(Handle<Typesystem> typesystem)
+{
+ typesystems.push_back(typesystem);
+}
+
/* Class SystemTypesystem */
SystemTypesystem::SystemTypesystem(Manager &mgr)
diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp
index 1b54a07..803d0e8 100644
--- a/src/core/model/Typesystem.hpp
+++ b/src/core/model/Typesystem.hpp
@@ -679,8 +679,8 @@ public:
*/
static Rooted<StructType> createValidated(
Manager &mgr, std::string name, Handle<Typesystem> system,
- Handle<StructType> parentStructure, const NodeVector<Attribute> &attributes,
- Logger &logger);
+ Handle<StructType> parentStructure,
+ const NodeVector<Attribute> &attributes, Logger &logger);
/**
* Returns a handle pointing at the parent type.
@@ -945,6 +945,11 @@ private:
*/
NodeVector<Constant> constants;
+ /**
+ * List containing references to other referenced typesystems.
+ */
+ NodeVector<Typesystem> typesystems;
+
protected:
void doResolve(ResolutionState &state) override;
@@ -958,7 +963,10 @@ public:
* @param name is the name of the typesystem.
*/
Typesystem(Manager &mgr, std::string name)
- : Node(mgr, std::move(name)), types(this), constants(this)
+ : Node(mgr, std::move(name)),
+ types(this),
+ constants(this),
+ typesystems(this)
{
}
@@ -972,6 +980,14 @@ public:
Rooted<StructType> createStructType(const std::string &name);
/**
+ * Adds a reference to the given typesystem class.
+ *
+ * @param typesystem is the typesystem that should be added to the
+ * referenced typesystems list.
+ */
+ void includeTypesystem(Handle<Typesystem> typesystem);
+
+ /**
* Adds the given type to the to the type list.
*
* @param type is the Type that should be stored in this Typesystem