From ade7f1ba84a08309ea41a2cd5517a48f95a9dbc0 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 5 Nov 2023 16:33:16 +0200 Subject: [PATCH] Compiler - Made `gibFileData(string sourceFile)` public - Added `getTypeChecker()` to the `Compiler` class --- source/tlang/compiler/core.d | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/tlang/compiler/core.d b/source/tlang/compiler/core.d index be2bb2f8d..608398f4f 100644 --- a/source/tlang/compiler/core.d +++ b/source/tlang/compiler/core.d @@ -196,6 +196,25 @@ public class Compiler this.typeChecker.beginCheck(); } + /** + * Returns the type checker instance of + * this compiler + * + * Returns: the type checker + * Throws: + * CompilerException if you have not + * called `doTypeCheck()` yet + */ + public TypeChecker getTypeChecker() + { + if(typeChecker is null) + { + throw new CompilerException(CompilerError.TYPECHECK_NOT_YET_PERFORMED); + } + + return this.typeChecker; + } + /* Perform code emitting */ public void doEmit() { @@ -255,7 +274,7 @@ public class Compiler * sourceFile = the path to the file to open * Returns: the source data */ -private string gibFileData(string sourceFile) +public string gibFileData(string sourceFile) { File sourceFileFile; sourceFileFile.open(sourceFile); /* TODO: Error handling with ANY file I/O */