From c39bc20d1c5f9f5d27f3d992df4356b00e65fc88 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 11 Dec 2022 18:40:12 +0200 Subject: [PATCH] VariableDeclaration (WIP) - Added `emit()` method to fetch name for now and emit a string --- source/tlang/compiler/codegen/instruction.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/tlang/compiler/codegen/instruction.d b/source/tlang/compiler/codegen/instruction.d index 324174da..7e92597a 100644 --- a/source/tlang/compiler/codegen/instruction.d +++ b/source/tlang/compiler/codegen/instruction.d @@ -74,6 +74,7 @@ public final class VariableDeclaration : StorageDeclaration /* Length */ public byte length; + //TODO: This must take in type information this(string varName, byte len) { this.varName = varName; @@ -85,7 +86,11 @@ public final class VariableDeclaration : StorageDeclaration public override string emit() { // TODO: This should change - return "my var"; + // TODO: We should be having a type pushed into this thing (lookup via Context?) + string type = ""; + string fullEntityName = context.tc.getResolver().generateName(context.getContainer(), context.tc.getResolver().resolveBest(context.getContainer(), varName)); + + return type~" "~fullEntityName~";"; } }