diff options
-rw-r--r-- | src/convert/typecheck_expr.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/convert/typecheck_expr.cpp b/src/convert/typecheck_expr.cpp index 83becce1..60a63a5b 100644 --- a/src/convert/typecheck_expr.cpp +++ b/src/convert/typecheck_expr.cpp @@ -10,13 +10,37 @@ class CTypeChecker: public CASTIterator { public: - virtual void handle_function(AST::Path& path, AST::Function& fcn) override; + virtual void handle_function(AST::Path path, AST::Function& fcn) override; + // - Ignore all non-function items on this pass + virtual void handle_enum(AST::Path path, AST::Enum& ) override {} + virtual void handle_struct(AST::Path path, AST::Struct& str) override {} + virtual void handle_alias(AST::Path path, AST::TypeAlias& ) override {} +}; +class CNodeVisitor: + public AST::NodeVisitor +{ + CTypeChecker& m_tc; +public: + CNodeVisitor(CTypeChecker& tc): + m_tc(tc) + {} + + void visit(AST::ExprNode_LetBinding& node) override; }; -void CTypeChecker::handle_function(AST::Path& path, AST::Function& fcn) +void CTypeChecker::handle_function(AST::Path path, AST::Function& fcn) { - + CNodeVisitor nv(*this); + if( fcn.code().is_valid() ) + { + fcn.code().visit_nodes(nv); + } +} + +void CNodeVisitor::visit(AST::ExprNode_LetBinding& node) +{ + // TODO: } void Typecheck_Expr(AST::Crate& crate) |