diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-01 13:18:52 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-01 13:18:52 +0800 |
commit | fc4c8a1e3d2994b24bc4f7f573d49be99c1dabcf (patch) | |
tree | 9ed4422427ba5c3303643edf7eaf37cd3b9cbed1 /src | |
parent | 67ab325a8c67ae39dd5b5c7b790db96469d6902d (diff) | |
download | mrust-fc4c8a1e3d2994b24bc4f7f573d49be99c1dabcf.tar.gz |
HIR Typecheck CS - Apply/check let and closure nodes
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 56f71f87..792007fb 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1773,12 +1773,26 @@ namespace { void visit_node_ptr(::HIR::ExprNodeP& node) override { const char* node_ty = typeid(*node).name(); TRACE_FUNCTION_FR(&node << " " << &*node << " " << node_ty << " : " << node->m_res_type, node_ty); - this->check_type_resolved(node->span(), node->m_res_type, node->m_res_type); + this->check_type_resolved_top(node->span(), node->m_res_type); DEBUG(node_ty << " : = " << node->m_res_type); ::HIR::ExprVisitorDef::visit_node_ptr(node); } + void visit(::HIR::ExprNode_Let& node) override { + this->check_type_resolved_top(node.span(), node.m_type); + ::HIR::ExprVisitorDef::visit(node); + } + void visit(::HIR::ExprNode_Closure& node) override { + for(auto& arg : node.m_args) + this->check_type_resolved_top(node.span(), arg.second); + this->check_type_resolved_top(node.span(), node.m_return); + ::HIR::ExprVisitorDef::visit(node); + } + private: + void check_type_resolved_top(const Span& sp, ::HIR::TypeRef& ty) const { + check_type_resolved(sp, ty, ty); + } void check_type_resolved(const Span& sp, ::HIR::TypeRef& ty, const ::HIR::TypeRef& top_type) const { TU_MATCH(::HIR::TypeRef::Data, (ty.m_data), (e), (Infer, |