From b9c87bb2778ead7f353049e7078672f9a6f61f25 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Sun, 18 Jan 2015 23:09:47 +0800 Subject: Starting on (framework) for in-function inferrence --- src/convert/typecheck_expr.cpp | 29 +++++++++++++++++++++++++++++ src/include/main_bindings.hpp | 1 + src/main.cpp | 1 + 3 files changed, 31 insertions(+) create mode 100644 src/convert/typecheck_expr.cpp (limited to 'src') diff --git a/src/convert/typecheck_expr.cpp b/src/convert/typecheck_expr.cpp new file mode 100644 index 00000000..83becce1 --- /dev/null +++ b/src/convert/typecheck_expr.cpp @@ -0,0 +1,29 @@ +/* + */ +#include +#include "ast_iterate.hpp" +#include "../common.hpp" +#include + +// === PROTOTYPES === +class CTypeChecker: + public CASTIterator +{ +public: + virtual void handle_function(AST::Path& path, AST::Function& fcn) override; +}; + + +void CTypeChecker::handle_function(AST::Path& path, AST::Function& fcn) +{ + +} + +void Typecheck_Expr(AST::Crate& crate) +{ + DEBUG(" >>>"); + CTypeChecker tc; + tc.handle_module(AST::Path({}), crate.root_module()); + DEBUG(" <<<"); +} + diff --git a/src/include/main_bindings.hpp b/src/include/main_bindings.hpp index 00b90ef3..b7161edd 100644 --- a/src/include/main_bindings.hpp +++ b/src/include/main_bindings.hpp @@ -9,6 +9,7 @@ extern AST::Crate Parse_Crate(::std::string mainfile); extern void ResolvePaths(AST::Crate& crate); extern void Typecheck_GenericBounds(AST::Crate& crate); extern void Typecheck_GenericParams(AST::Crate& crate); +extern void Typecheck_Expr(AST::Crate& crate); extern AST::Flat Convert_Flatten(const AST::Crate& crate); #endif diff --git a/src/main.cpp b/src/main.cpp index c3952a35..3c2a2787 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -96,6 +96,7 @@ int main(int argc, char *argv[]) // - Typecheck statics and consts // - Typecheck + propagate functions // > Forward pass first + Typecheck_Expr(crate); if( strcmp(emit_type, "ast") == 0 ) { -- cgit v1.2.3