summaryrefslogtreecommitdiff
path: root/src/types.hpp
diff options
context:
space:
mode:
authorJohn Hodge (sonata) <tpg@mutabah.net>2015-01-21 20:30:20 +0800
committerJohn Hodge (sonata) <tpg@mutabah.net>2015-01-21 20:30:20 +0800
commit8d1acfa3993e64b0266365379602799350855f3f (patch)
tree8ebd1c2c02a322714d2ea64776ac504f955d5fd6 /src/types.hpp
parent15284f127f4c622bf4d67d8d8c44e1799f84e7cb (diff)
downloadmrust-8d1acfa3993e64b0266365379602799350855f3f.tar.gz
Type propagation coming along
Diffstat (limited to 'src/types.hpp')
-rw-r--r--src/types.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/types.hpp b/src/types.hpp
index 2c3a2056..27d74662 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -123,6 +123,10 @@ public:
/// Merge with another type (combines known aspects, conflitcs cause an exception)
void merge_with(const TypeRef& other);
+ /// Replace 'GENERIC' entries with the return value of the closure
+ void resolve_args(::std::function<TypeRef(const char*)> fcn);
+ /// Match 'GENERIC' entries with another type, passing matches to a closure
+ void match_args(const TypeRef& other, ::std::function<void(const char*,const TypeRef&)> fcn) const;
/// Returns true if the type is fully known (all sub-types are not wildcards)
bool is_concrete() const;
@@ -131,6 +135,7 @@ public:
bool is_unit() const { return m_class == UNIT; }
bool is_path() const { return m_class == PATH; }
bool is_type_param() const { return m_class == GENERIC; }
+ bool is_reference() const { return m_class == REFERENCE; }
const ::std::string& type_param() const { assert(is_type_param()); return m_path[0].name(); }
AST::Path& path() { assert(is_path() || m_class == ASSOCIATED); return m_path; }
::std::vector<TypeRef>& sub_types() { return m_inner_types; }