diff --git a/source/tlang/compiler/codegen/emit/dgen.d b/source/tlang/compiler/codegen/emit/dgen.d index 48981501..db20dede 100644 --- a/source/tlang/compiler/codegen/emit/dgen.d +++ b/source/tlang/compiler/codegen/emit/dgen.d @@ -44,8 +44,7 @@ public final class DCodeEmitter : CodeEmitter string moduleName = typeChecker.getResolver().generateName(typeChecker.getModule(), typeChecker.getModule()); //TODO: Lookup actual module name (I was lazy) string outputCFilename = file.name(); - file.write(` -/** + file.write(`/** * TLP compiler generated code * * Module name: `); diff --git a/source/tlang/compiler/typecheck/resolution.d b/source/tlang/compiler/typecheck/resolution.d index caaa0ffe..a51b5a96 100644 --- a/source/tlang/compiler/typecheck/resolution.d +++ b/source/tlang/compiler/typecheck/resolution.d @@ -4,6 +4,7 @@ import compiler.typecheck.core; import gogga; import compiler.symbols.data; import std.string; +import std.conv : to; public final class Resolver { @@ -123,6 +124,9 @@ public final class Resolver * cast should never fail */ assert(cast(Entity) currentEntity.parentOf()); + // FIXME: Enable this below whenever we have any sort of crash + // (There is a case where we have it fail on `Variable (Ident: p, Type: int)`) + gprintln("AssertFail Check: "~to!(string)(currentEntity)); currentEntity = cast(Entity)(currentEntity.parentOf()); if (currentEntity == c) diff --git a/source/tlang/testing/typecheck/simple_dependence_correct7.t b/source/tlang/testing/typecheck/simple_dependence_correct7.t index d465767e..9354ec04 100644 --- a/source/tlang/testing/typecheck/simple_dependence_correct7.t +++ b/source/tlang/testing/typecheck/simple_dependence_correct7.t @@ -1,7 +1,8 @@ module typeChecking3; - +discard "rsolution.d(126) seems to fail below (REMOVE THIS WHEN FIXED)"; +int t; int p = 21; p=2+p; int j = 2; diff --git a/tlangout.c b/tlangout.c new file mode 100644 index 00000000..d78c83dd --- /dev/null +++ b/tlangout.c @@ -0,0 +1,12 @@ + +/** + * TLP compiler generated code + * + * Module name: simple_variables + * Output C file: tlangout.c + */ + +[Instruction: compiler.codegen.instruction.VariableDeclaration:varName: simple_variables.x] +[Instruction: compiler.codegen.instruction.VariableAssignmentInstr:assignTo: simple_variables.x, valInstr: [Instruction: compiler.codegen.instruction.BinOpInstr:BinOpType: ADD, LhsValInstr: [Instruction: compiler.codegen.instruction.LiteralValue:Data: 1, Length: 4], RhsValInstr: [Instruction: compiler.codegen.instruction.LiteralValue:Data: 2, Length: 4]]] +[Instruction: compiler.codegen.instruction.VariableDeclaration:varName: simple_variables.y] +[Instruction: compiler.codegen.instruction.VariableAssignmentInstr:assignTo: simple_variables.y, valInstr: [Instruction: compiler.codegen.instruction.LiteralValue:Data: 2, Length: 4]]