From 449e8787965e3d0130880f72626e88a6bbf70685 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Sun, 18 Sep 2022 21:52:11 +0200 Subject: [PATCH] Fixed bug when processing the body of a class and a DNode was hit which was not one of the allowed types: 1. VariableDeclaration Previously we added back the `varDecInstr` which is post-cast and if the cast failed (hence hitting this !varDecInstr branch) we didn't add back `instr` but rather added back `varDecInstr` which is 0 instead of being non-zero. This later is incorrect. --- source/tlang/compiler/typecheck/core.d | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index 48f4a754..d929d7af 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -653,7 +653,6 @@ public final class TypeChecker /* TODO: Make sure this is correct */ addInstr(varDecInstr); gprintln("Hello>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - } @@ -688,12 +687,16 @@ public final class TypeChecker /* If not VariableDeclaration push back and end */ if(!varDecInstr) { - addInstr(varDecInstr); + addInstr(instr); + assert(varDecInstr is null); + assert(instr); break; } /* If, then make sure related to this class */ else { + gprintln("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); + /* TODO: Fetch the variable's context */ Variable varDecPNode = cast(Variable)resolver.resolveBest(clazzPNode, varDecInstr.varName); gprintln(varDecPNode); @@ -767,6 +770,11 @@ public final class TypeChecker VariableAssignmentInstr vAInstr = new VariableAssignmentInstr(variableName, valueInstr); addInstrB(vAInstr); } + /* Case of no matches */ + else + { + gprintln("NO MATCHES FIX ME FOR: "~to!(string)(statement), DebugType.WARNING); + } } @@ -788,7 +796,9 @@ public final class TypeChecker gprintln("Process: "~to!(string)(node)); /* Print the code queue each time */ + gprintln("sdfhjkhdsfjhfdsj 1"); printCodeQueue(); + gprintln("sdfhjkhdsfjhfdsj 2"); /** * Now depending on thr DNode type we should