From 272bfee12483966dcceb9af7b9726a6ac1d492e0 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 11 Dec 2022 19:36:31 +0200 Subject: [PATCH] VariableDeclaration - Added docstring - Cleaned up and refactored out into two separate statements (for variable name generation) --- source/tlang/compiler/codegen/instruction.d | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/tlang/compiler/codegen/instruction.d b/source/tlang/compiler/codegen/instruction.d index 26f184c..8b1823c 100644 --- a/source/tlang/compiler/codegen/instruction.d +++ b/source/tlang/compiler/codegen/instruction.d @@ -87,12 +87,19 @@ public final class VariableDeclaration : StorageDeclaration addInfo = "varName: "~varName; } + /** + * Emits a string of the form: + * + * ; + * + * Returns: The emitted code + */ public override string emit() { - string type = varType; - string fullEntityName = context.tc.getResolver().generateName(context.getContainer(), context.tc.getResolver().resolveBest(context.getContainer(), varName)); + auto typedEntityVariable = context.tc.getResolver().resolveBest(context.getContainer(), varName); //TODO: Remove `auto` + string typedEntityVariableName = context.tc.getResolver().generateName(context.getContainer(), typedEntityVariable); - return type~" "~fullEntityName~";"; + return varType~" "~typedEntityVariableName~";"; } }