diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir/expr_ptr.hpp | 5 | ||||
-rw-r--r-- | src/hir_expand/closures.cpp | 4 | ||||
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/hir/expr_ptr.hpp b/src/hir/expr_ptr.hpp index 12ebddd2..a4c04d2b 100644 --- a/src/hir/expr_ptr.hpp +++ b/src/hir/expr_ptr.hpp @@ -2,6 +2,7 @@ */ #pragma once #include <memory> +#include <vector> namespace MIR { class Function; @@ -9,6 +10,7 @@ class Function; namespace HIR { +class TypeRef; class ExprNode; class ExprPtr @@ -16,6 +18,9 @@ class ExprPtr ::HIR::ExprNode* node; public: + ::std::vector< ::HIR::TypeRef> m_bindings; + +public: ExprPtr(); ExprPtr(::std::unique_ptr< ::HIR::ExprNode> _); ExprPtr(ExprPtr&& x): diff --git a/src/hir_expand/closures.cpp b/src/hir_expand/closures.cpp index aa63861a..f0d10015 100644 --- a/src/hir_expand/closures.cpp +++ b/src/hir_expand/closures.cpp @@ -445,6 +445,7 @@ namespace { if( !m_closure_stack.empty() ) { // If attempting to use a Copy type by value, it can just be a Borrow of the inner type + assert(m_usage.size() > 0); if( m_usage.back() == Usage::Move && type_is_copy(node.m_res_type) ) { m_usage.push_back(Usage::Borrow); node.m_value->visit( *this ); @@ -702,9 +703,8 @@ namespace { if( item.m_code ) { DEBUG("Function code " << p); - ::std::vector< ::HIR::TypeRef> tmp; //ExprVisitor_Extract ev(item.m_code.binding_types); - ExprVisitor_Extract ev(m_resolve, tmp, m_new_trait_impls, m_new_types); + ExprVisitor_Extract ev(m_resolve, item.m_code.m_bindings, m_new_trait_impls, m_new_types); ev.visit_root( *item.m_code ); } else diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 33109fa0..978333d7 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -3964,5 +3964,8 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: visitor.visit_node_ptr( root_ptr ); } expr = ::HIR::ExprPtr( mv$(root_ptr) ); + expr.m_bindings.reserve( context.m_bindings.size() ); + for(auto& binding : context.m_bindings) + expr.m_bindings.push_back( mv$(binding.ty) ); } |