diff options
Diffstat (limited to 'src/types.hpp')
-rw-r--r-- | src/types.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/types.hpp b/src/types.hpp index 4ef24685..1dfeebac 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -26,6 +26,7 @@ class TypeRef: ARRAY,
GENERIC,
PATH,
+ ASSOCIATED,
};
Class m_class;
@@ -97,6 +98,16 @@ public: TypeRef(TagPath(), ::std::move(path))
{}
+ struct TagAssoc {};
+ TypeRef(TagAssoc, TypeRef base, TypeRef trait, ::std::string assoc_name):
+ TypeRef(::std::move(base), ::std::move(trait), ::std::move(assoc_name))
+ {}
+ TypeRef(TypeRef base, TypeRef trait, ::std::string assoc_name):
+ m_class(ASSOCIATED),
+ m_path( {AST::PathNode(assoc_name, {})} ),
+ m_inner_types( {::std::move(base), ::std::move(trait)} )
+ {}
+
bool is_path() const { return m_class == PATH; }
AST::Path& path() { assert(is_path()); return m_path; }
::std::vector<TypeRef>& sub_types() { return m_inner_types; }
|