From 6649804d4e1b96d0ade5592c079b2e7e4d9f3208 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 30 Mar 2021 17:31:37 +0200 Subject: [PATCH] Refactoring Removed uneeded type 'Symbol' --- source/tlang/compiler/compiler.d | 2 +- source/tlang/compiler/symbols/check.d | 0 source/tlang/compiler/symbols/data.d | 0 source/tlang/compiler/{ => symbols}/symbols.d | 16 ++-------------- .../compiler/{typecheck.d => typecheck/core.d} | 2 +- source/tlang/testing/basic1.t | 2 +- 6 files changed, 5 insertions(+), 17 deletions(-) create mode 100644 source/tlang/compiler/symbols/check.d create mode 100644 source/tlang/compiler/symbols/data.d rename source/tlang/compiler/{ => symbols}/symbols.d (98%) rename source/tlang/compiler/{typecheck.d => typecheck/core.d} (99%) diff --git a/source/tlang/compiler/compiler.d b/source/tlang/compiler/compiler.d index 06a2324..6064491 100644 --- a/source/tlang/compiler/compiler.d +++ b/source/tlang/compiler/compiler.d @@ -6,7 +6,7 @@ import compiler.lexer; import std.stdio : File; import compiler.parser; import compiler.symbols; -import compiler.typecheck; +import compiler.typecheck.core; void beginCompilation(string[] sourceFiles) { diff --git a/source/tlang/compiler/symbols/check.d b/source/tlang/compiler/symbols/check.d new file mode 100644 index 0000000..e69de29 diff --git a/source/tlang/compiler/symbols/data.d b/source/tlang/compiler/symbols/data.d new file mode 100644 index 0000000..e69de29 diff --git a/source/tlang/compiler/symbols.d b/source/tlang/compiler/symbols/symbols.d similarity index 98% rename from source/tlang/compiler/symbols.d rename to source/tlang/compiler/symbols/symbols.d index f4b59d6..1376acb 100644 --- a/source/tlang/compiler/symbols.d +++ b/source/tlang/compiler/symbols/symbols.d @@ -46,18 +46,6 @@ public enum SymbolType UNKNOWN } -public class Symbol -{ - /* Token */ - private Token token; - private SymbolType symbolType; - - this(SymbolType symbolType, Token token) - { - this.token = token; - this.symbolType = symbolType; - } -} @@ -677,7 +665,7 @@ public class Variable : TypedEntity public class Expression : Statement { - import compiler.typecheck; + import compiler.typecheck.core; /* TODO: Takes in symbol table? */ public string evaluateType(TypeChecker typechecker, Container c) { @@ -788,7 +776,7 @@ public class VariableExpression : IdentExpression super(identifier); } - import compiler.typecheck; + import compiler.typecheck.core; public override string evaluateType(TypeChecker typeChecker, Container c) { string type; diff --git a/source/tlang/compiler/typecheck.d b/source/tlang/compiler/typecheck/core.d similarity index 99% rename from source/tlang/compiler/typecheck.d rename to source/tlang/compiler/typecheck/core.d index eb40ac8..0ffb738 100644 --- a/source/tlang/compiler/typecheck.d +++ b/source/tlang/compiler/typecheck/core.d @@ -1,4 +1,4 @@ -module compiler.typecheck; +module compiler.typecheck.core; import compiler.symbols; import std.conv : to; diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index c1d89df..46ab2ab 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -19,7 +19,7 @@ int ll = f(1,1); public ubyte k = 1; private ubyte k2 = 1; -protected ubyte k3 = 1-1; +protected ubyte k3 = -1; public class clazz1