diff options
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), |