From d00036ff8e80dee7aa0dce763ec41fb6b67fff76 Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 1 Feb 2016 20:26:02 -0500 Subject: [PATCH] Clean variable symbols as well Even though it is kind of ass (a variable is considered used even if it simply has a single definition statement)... --- ssc/compiler.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ssc/compiler.cs b/ssc/compiler.cs index d1dc722..d99801f 100644 --- a/ssc/compiler.cs +++ b/ssc/compiler.cs @@ -89,7 +89,7 @@ namespace arookas { void CleanSymbols() { var i = 0; while (i < mContext.SymbolTable.Count) { - if (mContext.SymbolTable[i] is sunCallableSymbol && !mContext.SymbolTable[i].HasRelocations) { + if (!mContext.SymbolTable[i].HasRelocations) { mContext.SymbolTable.RemoveAt(i); continue; } @@ -102,6 +102,15 @@ namespace arookas { } builtin.Index = i; } + var vars = 0; + for (i = 0; i < mContext.SymbolTable.Count; ++i) { + var variable = mContext.SymbolTable[i] as sunVariableSymbol; + if (variable == null) { + continue; + } + variable.Display = 0; + variable.Index = vars++; + } } #endif void CompileRelocations() {