summaryrefslogtreecommitdiff
path: root/src/types.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-15 10:27:03 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-15 10:27:03 +0800
commit3d8538bb3eba616001ff3c89d995e4190cfe1272 (patch)
tree620979c6897bd0e75067c6a16df5dd9a649acc73 /src/types.hpp
parentbf14a518b591b8f43a92c13d85b1ae5db8965703 (diff)
downloadmrust-3d8538bb3eba616001ff3c89d995e4190cfe1272.tar.gz
Function types
Diffstat (limited to 'src/types.hpp')
-rw-r--r--src/types.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/types.hpp b/src/types.hpp
index d15c77ab..dad4493b 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -47,6 +47,7 @@ class TypeRef:
//BOUNDED, //< '_: Traits' - Bounded type (a resolved type parameter usually)
UNIT, //< '()' - Unit / void
PRIMITIVE, //< Any primitive (builtin type)
+ FUNCTION,
TUPLE,
REFERENCE,
POINTER,
@@ -88,6 +89,15 @@ public:
m_class(TUPLE),
m_inner_types( ::std::move(inner_types) )
{}
+ struct TagFunction {};
+ TypeRef(TagFunction, ::std::string abi, ::std::vector<TypeRef> args, TypeRef ret):
+ m_class(FUNCTION),
+ m_path( {AST::PathNode( ::std::move(abi), {})} ), // abuse path for string
+ m_inner_types( ::std::move(args) )
+ {
+ m_inner_types.push_back( ::std::move(ret) );
+ }
+
struct TagReference {};
TypeRef(TagReference _, bool is_mut, TypeRef inner_type):
m_class(REFERENCE),