From be3b2085ad2e2b8b31e856594896bd81297d33b5 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Mon, 30 Jan 2023 19:03:48 +0200 Subject: [PATCH] Instructions - All `Value` instructions are to have a `Type` field named `type` - Removed the `len` field in `LiteralValue` - Replaced the `data` field of typr `ulong` with a `data` field of type `string` in `LiteralValue` - Replaced the `data` field of typr `ulong` with a `data` field of type `string` in `LiteralValueFloat` --- source/tlang/compiler/codegen/instruction.d | 24 ++++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/source/tlang/compiler/codegen/instruction.d b/source/tlang/compiler/codegen/instruction.d index 104ecaf8..7ec50861 100644 --- a/source/tlang/compiler/codegen/instruction.d +++ b/source/tlang/compiler/codegen/instruction.d @@ -38,7 +38,7 @@ public class FetchInst : Instruction public class Value : Instruction { - + public Type type; } public class StorageDeclaration : Instruction @@ -59,9 +59,9 @@ public class VariableAssignmentInstr : Instruction /* Name of variable being declared */ public string varName; /*TODO: Might not be needed */ - public const Instruction data; + public const Value data; // TODO: Make `Value` to constrain - this(string varName, Instruction data) + this(string varName, Value data) { this.varName = varName; this.data = data; @@ -124,30 +124,28 @@ public final class FetchValueVar : Value public final class LiteralValue : Value { /* Data */ - public ulong data; - public byte len; + public string data; - this(ulong data, byte len) + this(string data, Type type) { this.data = data; - this.len = len; + this.type = type; - addInfo = "Data: "~to!(string)(data)~", Length: "~to!(string)(len); + addInfo = "Data: "~to!(string)(data)~", Type: "~to!(string)(type); } } public final class LiteralValueFloat : Value { /* Data */ - public double data; /* TODO: Is this best way to store? Consirring floats/doubles */ - public byte len; + public string data; /* TODO: Is this best way to store? Consirring floats/doubles */ - this(double data, byte len) + this(string data, Type type) { this.data = data; - this.len = len; + this.type = type; - addInfo = "Data: "~to!(string)(data)~", Length: "~to!(string)(len); + addInfo = "Data: "~to!(string)(data)~", Type: "~to!(string)(type); } }