From 1e2ef795d6d4693bb0ec9fed13fd9e91a0d18b1f Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 11 Dec 2022 18:12:46 +0200 Subject: [PATCH] Instruction - Added `emit()` method to base Instruction class - Fixed typo in name of `StorageDeclaration` class - WIP: `VariableDeclaration` emit() --- source/tlang/compiler/codegen/instruction.d | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/tlang/compiler/codegen/instruction.d b/source/tlang/compiler/codegen/instruction.d index 85647446..324174da 100644 --- a/source/tlang/compiler/codegen/instruction.d +++ b/source/tlang/compiler/codegen/instruction.d @@ -20,6 +20,11 @@ public class Instruction { return "[Instruction: "~this.classinfo.name~":"~addInfo~"]"; } + + public string emit() + { + return "TODO: This instruction has not provided an emit text yet! (This is an error!)"; + } } public class FetchInst : Instruction @@ -32,7 +37,7 @@ public class Value : Instruction } -public class StorageDeclaratio : Instruction +public class StorageDeclaration : Instruction { } @@ -61,7 +66,7 @@ public class VariableAssignmentInstr : Instruction } } -public final class VariableDeclaration : StorageDeclaratio +public final class VariableDeclaration : StorageDeclaration { /* Name of variable being declared */ public string varName; @@ -76,6 +81,12 @@ public final class VariableDeclaration : StorageDeclaratio addInfo = "varName: "~varName; } + + public override string emit() + { + // TODO: This should change + return "my var"; + } } public final class FetchValueVar : Value