diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-22 20:03:11 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-22 20:03:11 +0800 |
commit | 2f9acf36cfd475dc48b7a46e4cdff1b284529a79 (patch) | |
tree | 50b25571223d37ad30430d573a6857b846941598 /src/hir/from_ast.cpp | |
parent | 96621f217b750115c01457d79a74f9676164b463 (diff) | |
download | mrust-2f9acf36cfd475dc48b7a46e4cdff1b284529a79.tar.gz |
AST+HIR - Save decoded receiver type for methods
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r-- | src/hir/from_ast.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index 4fe9759c..6a43b790 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -891,13 +891,31 @@ namespace { } ::HIR::Function LowerHIR_Function(::HIR::ItemPath p, const ::AST::Function& f) { + static Span sp; + DEBUG(p); ::std::vector< ::std::pair< ::HIR::Pattern, ::HIR::TypeRef > > args; for(const auto& arg : f.args()) args.push_back( ::std::make_pair( LowerHIR_Pattern(arg.first), LowerHIR_Type(arg.second) ) ); + auto receiver = ::HIR::Function::Receiver::Free; + + switch( f.receiver() ) + { + #define _(N) case ::AST::Function::Receiver::N: receiver = ::HIR::Function::Receiver::N; break; + _(Free) + _(Value) + _(BorrowOwned) + _(BorrowUnique) + _(BorrowShared) + //case ::AST::Function::Receiver::Box: + // break; + #undef _ + } + // TODO: ABI and unsafety/constness return ::HIR::Function { + receiver, "rust", false, false, LowerHIR_GenericParams(f.params(), nullptr), // TODO: If this is a method, then it can add the Self: Sized bound mv$(args), |