diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-31 22:40:04 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-31 22:40:04 +0800 |
commit | c2684e5058415746c83e38676f91bfc32d2ee6eb (patch) | |
tree | 98ce27dcd287f52b261f9346d7bfc98ac8776483 /src/convert/resolve.cpp | |
parent | c5b773f72a8ef077d8d189912014f64431825df5 (diff) | |
download | mrust-c2684e5058415746c83e38676f91bfc32d2ee6eb.tar.gz |
Root-level typecheck now up to requiring Sized
Diffstat (limited to 'src/convert/resolve.cpp')
-rw-r--r-- | src/convert/resolve.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/convert/resolve.cpp b/src/convert/resolve.cpp index 3e690f61..bca0f576 100644 --- a/src/convert/resolve.cpp +++ b/src/convert/resolve.cpp @@ -23,15 +23,15 @@ class CPathResolver: VAR,
} type;
::std::string name;
- AST::Path path;
+ TypeRef tr;
LocalItem():
type(VAR), name()
{}
- LocalItem(Type t, ::std::string name, AST::Path path=AST::Path()):
+ LocalItem(Type t, ::std::string name, TypeRef tr=TypeRef()):
type(t),
name( ::std::move(name) ),
- path( ::std::move(path) )
+ tr( ::std::move(tr) )
{}
friend ::std::ostream& operator<<(::std::ostream& os, const LocalItem& x) {
@@ -60,7 +60,7 @@ public: virtual void start_scope() override;
virtual void local_type(::std::string name, TypeRef type) override {
- m_locals.push_back( LocalItem(LocalItem::TYPE, ::std::move(name)) );
+ m_locals.push_back( LocalItem(LocalItem::TYPE, ::std::move(name), ::std::move(type)) );
}
virtual void local_variable(bool _is_mut, ::std::string name, const TypeRef& _type) override {
m_locals.push_back( LocalItem(LocalItem::VAR, ::std::move(name)) );
@@ -500,6 +500,19 @@ void CPathResolver::handle_type(TypeRef& type) // Not a type param, fall back to other checks
}
}
+
+ //if( type.is_type_param() && type.type_param() == "Self" )
+ //{
+ // auto l = lookup_local(LocalItem::TYPE, "Self");
+ // if( l.is_some() )
+ // {
+ // type = l.unwrap().tr;
+ // DEBUG("Replacing Self with " << type);
+ // // TODO: Can this recurse?
+ // handle_type(type);
+ // return ;
+ // }
+ //}
CASTIterator::handle_type(type);
DEBUG("res = " << type);
}
|