summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-22 20:03:11 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-22 20:03:11 +0800
commit2f9acf36cfd475dc48b7a46e4cdff1b284529a79 (patch)
tree50b25571223d37ad30430d573a6857b846941598 /src/hir/from_ast.cpp
parent96621f217b750115c01457d79a74f9676164b463 (diff)
downloadmrust-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.cpp18
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),