summaryrefslogtreecommitdiff
path: root/src/convert/ast_iterate.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-06-04 14:41:34 +0800
committerJohn Hodge <tpg@mutabah.net>2015-06-04 14:41:34 +0800
commitf15fcf3c440e3c9c40fa606b0904fb85a8510464 (patch)
treea477b63bf9d9141b170292aedb6df9cf8eeb2580 /src/convert/ast_iterate.cpp
parent029bf073a1ec77a06d6c64ab7166c74f13486926 (diff)
downloadmrust-f15fcf3c440e3c9c40fa606b0904fb85a8510464.tar.gz
Rework path handling and resolve to better handle Self
Diffstat (limited to 'src/convert/ast_iterate.cpp')
-rw-r--r--src/convert/ast_iterate.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/convert/ast_iterate.cpp b/src/convert/ast_iterate.cpp
index 49aa64c2..24dbf5f0 100644
--- a/src/convert/ast_iterate.cpp
+++ b/src/convert/ast_iterate.cpp
@@ -258,6 +258,24 @@ void CASTIterator::handle_function(AST::Path path, AST::Function& fcn)
DEBUG("ret type");
handle_type(fcn.rettype());
+ switch( fcn.fcn_class() )
+ {
+ case AST::Function::CLASS_UNBOUND:
+ break;
+ case AST::Function::CLASS_REFMETHOD:
+ local_variable(false, "self", TypeRef(TypeRef::TagReference(), false, TypeRef(TypeRef::TagArg(), "Self")));
+ break;
+ case AST::Function::CLASS_MUTMETHOD:
+ local_variable(false, "self", TypeRef(TypeRef::TagReference(), true, TypeRef(TypeRef::TagArg(), "Self")));
+ break;
+ case AST::Function::CLASS_VALMETHOD:
+ local_variable(false, "self", TypeRef(TypeRef::TagArg(), "Self"));
+ break;
+ case AST::Function::CLASS_MUTVALMETHOD:
+ local_variable(true, "self", TypeRef(TypeRef::TagArg(), "Self"));
+ break;
+ }
+
DEBUG("args");
for( auto& arg : fcn.args() )
{
@@ -309,7 +327,7 @@ void CASTIterator::handle_impl(AST::Path modpath, AST::Impl& impl)
for( auto& fcn : impl.functions() )
{
DEBUG("- Function '" << fcn.name << "'");
- handle_function(AST::Path() + fcn.name, fcn.data);
+ handle_function(AST::Path(AST::Path::TagRelative()) + fcn.name, fcn.data);
}
end_scope();