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)...
This commit is contained in:
arookas 2016-02-01 20:26:02 -05:00
parent 085e04798e
commit d00036ff8e

View file

@ -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() {