diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 2fce29b0..b0ff5b9d 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2035,6 +2035,20 @@ namespace { ivars(context.m_ivars) { } + void visit_node_ptr(::HIR::ExprPtr& node_ptr) + { + auto& node = *node_ptr; + const char* node_ty = typeid(node).name(); + + TRACE_FUNCTION_FR(&node << " " << &node << " " << node_ty << " : " << node.m_res_type, node_ty); + this->check_type_resolved_top(node.span(), node.m_res_type); + DEBUG(node_ty << " : = " << node.m_res_type); + + node_ptr->visit(*this); + + for( auto& ty : node_ptr.m_bindings ) + this->check_type_resolved_top(node.span(), ty); + } void visit_node_ptr(::HIR::ExprNodeP& node_ptr) override { auto& node = *node_ptr; const char* node_ty = typeid(node).name(); @@ -3999,15 +4013,6 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: BUG(root_ptr->span(), "Spare rules left after typecheck stabilised"); } - // - Validate typeck - { - DEBUG("==== VALIDATE ==== (" << count << " rounds)"); - context.dump(); - - ExprVisitor_Apply visitor { context }; - visitor.visit_node_ptr( root_ptr ); - } - // - Recreate the pointer expr = ::HIR::ExprPtr( mv$(root_ptr) ); // > Steal the binding types @@ -4015,5 +4020,14 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR: for(auto& binding : context.m_bindings) { expr.m_bindings.push_back( mv$(binding.ty) ); } + + // - Validate typeck + { + DEBUG("==== VALIDATE ==== (" << count << " rounds)"); + context.dump(); + + ExprVisitor_Apply visitor { context }; + visitor.visit_node_ptr( expr ); + } } |