Fixed: incorrect variable count in header.

This commit is contained in:
arookas 2015-12-21 04:55:00 -05:00
parent 8e4d9acb31
commit 694210cd5a

View file

@ -10,6 +10,7 @@ namespace arookas
{ {
aBinaryWriter writer; aBinaryWriter writer;
uint textOffset, dataOffset, symbolOffset; uint textOffset, dataOffset, symbolOffset;
int varCount;
public sunWriter Text { get; private set; } public sunWriter Text { get; private set; }
public sunDataTable DataTable { get; private set; } public sunDataTable DataTable { get; private set; }
@ -93,6 +94,7 @@ namespace arookas
ImportResolver.EnterFile(file); ImportResolver.EnterFile(file);
var parser = new sunParser(); var parser = new sunParser();
var tree = parser.Parse(file); var tree = parser.Parse(file);
varCount += tree.MaxLocalCount;
tree.Compile(this); tree.Compile(this);
ImportResolver.ExitFile(file); ImportResolver.ExitFile(file);
} }
@ -236,7 +238,7 @@ namespace arookas
writer.WriteS32(DataTable.Count); writer.WriteS32(DataTable.Count);
writer.Write32(symbolOffset); writer.Write32(symbolOffset);
writer.WriteS32(SymbolTable.Count); writer.WriteS32(SymbolTable.Count);
writer.WriteS32(Scopes.Root.VariableCount); writer.WriteS32(varCount);
} }
} }