summaryrefslogtreecommitdiff
path: root/src/ast/path.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-03-31 20:10:15 +0800
committerJohn Hodge <tpg@mutabah.net>2015-03-31 20:10:15 +0800
commitc5b773f72a8ef077d8d189912014f64431825df5 (patch)
tree0324cb9b4f717204ae6a335795667b27edc54942 /src/ast/path.cpp
parent752202c3857b00d0aa53117573d4a931f79ed65d (diff)
downloadmrust-c5b773f72a8ef077d8d189912014f64431825df5.tar.gz
Replace arguments in paths, and fix edge case in resolve where types were not resolved if added as defaults
Diffstat (limited to 'src/ast/path.cpp')
-rw-r--r--src/ast/path.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ast/path.cpp b/src/ast/path.cpp
index 85559e0e..222ce918 100644
--- a/src/ast/path.cpp
+++ b/src/ast/path.cpp
@@ -326,6 +326,8 @@ void Path::check_param_counts(const TypeParams& params, bool expect_params, Path
unsigned int i = node.args().size();
const auto& p = params.ty_params()[i];
DEBUG("Extra #" << i << ", p = " << p);
+ // XXX: Currently, the default is just inserted (_ where not specified)
+ // - Erroring failed on transmute, and other omitted for inferrence instnaces
if( true || p.get_default() != TypeRef() )
node.args().push_back( p.get_default() );
else
@@ -385,6 +387,28 @@ void Path::bind_static(const Static& ent)
m_binding = PathBinding(&ent);
}
+void Path::resolve_args(::std::function<TypeRef(const char*)> fcn)
+{
+ TRACE_FUNCTION_F(*this);
+ for(auto& n : nodes())
+ {
+ for(auto& p : n.args())
+ p.resolve_args(fcn);
+ }
+
+ switch(m_class)
+ {
+ case Path::RELATIVE:
+ case Path::ABSOLUTE:
+ break;
+ case Path::LOCAL:
+ break;
+ case Path::UFCS:
+ m_ufcs[0].resolve_args(fcn);
+ m_ufcs[1].resolve_args(fcn);
+ break;
+ }
+}
Path& Path::operator+=(const Path& other)
{