From 1af072de8c11b01a23a53d986d9dfc361308aeef Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Sat, 27 Mar 2021 15:27:14 +0200 Subject: [PATCH] Added some more things --- source/tlang/compiler/typecheck.d | 37 ++++++++++++++++++++++++++++++- source/tlang/testing/basic1.t | 4 ++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/source/tlang/compiler/typecheck.d b/source/tlang/compiler/typecheck.d index 96c8654..108ec6f 100644 --- a/source/tlang/compiler/typecheck.d +++ b/source/tlang/compiler/typecheck.d @@ -28,7 +28,42 @@ public final class TypeChecker // writeln("Res:",isValidEntity(program.getStatements(), "clazz1")); // writeln("Res:",isValidEntity(program.getStatements(), "clazz_2_1.clazz_2_2")); - + //process(); + } + + /** + * List of currently declared variables + */ + private Entity[] declaredVars; + + + + /** + * Initialization order + */ + + /** + * Example: + * + * + * int a; + * int b = a; + * int c = b; + * Reversing must not work + * + * Only time it can is if the path is to something in a class as those should + * be initialized all before variables + */ + private void process(Statement[] statements) + { + /* Go through each entity and check them */ + + /* TODO: Starting with x, if `int x = clacc.class.class.i` */ + /* TODO: Then we getPath from the assignment aexpressiona nd eval it */ + /** + * TODO: The variable there cannot rely on x without it being initted, hence + * need for global list of declared variables + */ } /* Test name resolution */ diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index 61a451a..4672896 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -4,6 +4,10 @@ module bababoioey; int x; ubyte y; +int a; +int b = a; +int c = b; + public ubyte k = 1; private ubyte k2 = 1; protected ubyte k3 = -1;