[FIX] compiler: add _ prefix to local variables while compiling an expression

This commit is contained in:
Bruno Boi
2022-01-27 10:42:26 +01:00
committed by Aaron Bohy
parent aa95149997
commit bb6479f44f
7 changed files with 15 additions and 12 deletions
+2
View File
@@ -330,6 +330,8 @@ export function compileExprToArray(expr: string): Token[] {
// This assumes the expression has only one scope (incorrect but "good enough for now")
for (const token of tokens) {
if (token.type === "SYMBOL" && localVars.has(token.value)) {
token.originalValue = token.value;
token.value = `_${token.value}`;
token.isLocal = true;
}
}