From 4bbdd78b458fb0861194e420776f64d498144483 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Thu, 15 Apr 2021 17:26:14 +0200 Subject: [PATCH] WIP: checkDeinitionTypes Implement this to do type resolution --- source/tlang/compiler/typecheck/core.d | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index d2a99ac..0471724 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -47,12 +47,54 @@ public final class TypeChecker */ public void dependencyCheck() { + /* Check declaration and definition types */ + checkDefinitionTypes(modulle); + /* TODO: Implement me */ checkClassInherit(modulle); /* TODO: Process class ? vars funcs ?*/ } + /* TODO: Idk, maybe change */ + /* TODO: Just using for `checkDefinitionTypes` */ + + private void checkDefinitionTypes(Container c) + { + /* Check variable declarations */ + Variable[] variables; + + foreach (Statement statement; c.getStatements()) + { + if (statement !is null && cast(Variable) statement) + { + variables ~= cast(Variable) statement; + } + } + + /* Check function definitions */ + Function[] functions; + + foreach (Statement statement; c.getStatements()) + { + if (statement !is null && cast(Function) statement) + { + functions ~= cast(Function) statement; + } + } + + /* Check class inheritance types */ + Clazz[] classes; + + foreach (Statement statement; c.getStatements()) + { + if (statement !is null && cast(Clazz) statement) + { + classes ~= cast(Clazz) statement; + } + } + } + public void beginCheck() { /**