summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge (sonata) <tpg@mutabah.net>2015-01-18 23:09:47 +0800
committerJohn Hodge (sonata) <tpg@mutabah.net>2015-01-18 23:09:47 +0800
commitb9c87bb2778ead7f353049e7078672f9a6f61f25 (patch)
treee7fa77feb4365ed6cc014b5e849eed495d40e738
parent99da72da61653582d8e98075a7b3a03c36fc1976 (diff)
downloadmrust-b9c87bb2778ead7f353049e7078672f9a6f61f25.tar.gz
Starting on (framework) for in-function inferrence
-rw-r--r--Makefile2
-rw-r--r--src/convert/typecheck_expr.cpp29
-rw-r--r--src/include/main_bindings.hpp1
-rw-r--r--src/main.cpp1
4 files changed, 32 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 45d24a71..12469c9b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ OBJ := main.o macros.o types.o serialise.o
OBJ += ast/ast.o ast/path.o ast/expr.o
OBJ += parse/parseerror.o parse/lex.o parse/preproc.o parse/root.o parse/expr.o
OBJ += convert/ast_iterate.o
-OBJ += convert/resolve.o convert/typecheck_bounds.o convert/typecheck_params.o
+OBJ += convert/resolve.o convert/typecheck_bounds.o convert/typecheck_params.o convert/typecheck_expr.o
OBJ += convert/flatten.o convert/render.o
OBJ := $(addprefix $(OBJDIR),$(OBJ))
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 <main_bindings.hpp>
+#include "ast_iterate.hpp"
+#include "../common.hpp"
+#include <stdexcept>
+
+// === 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 )
{