diff options
author | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-19 20:13:46 +0800 |
---|---|---|
committer | John Hodge (sonata) <tpg@mutabah.net> | 2015-01-19 20:13:46 +0800 |
commit | 4be8e3955de42210e01ca90373e28690fee762c0 (patch) | |
tree | 9ec44e3884b41c3ff35a2a6279077bbc87eb498d | |
parent | b9c87bb2778ead7f353049e7078672f9a6f61f25 (diff) | |
download | mrust-4be8e3955de42210e01ca90373e28690fee762c0.tar.gz |
Fiddle
-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) |