1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-04-22 01:16:42 +00:00

Set Anattrib DataDescriptor for local variable references

We now generate FormatDescriptors with WeakSymbolRefs for direct
page references that match variable table entries.

LocalVariableTable got a rewrite.  We need to be unique in both
name and address, but for the address we have to take the width into
account as well.  We also want to sort the display by address
rather than name.  (Some people might want it sorted by name, but
we can worry about that some other time.)

Updated the DefSymbol editor to require value uniqueness.  Note
addresses and constants exist in separate namespaces.

The various symbols are added to the SymbolTable so that uniqueness
checks work correctly.  This also allows the operand generation to
appear to work, but it doesn't yet handle redefinition of symbols.
This commit is contained in:
Andy McFadden
2019-08-28 17:34:29 -07:00
parent c4c67757c0
commit 0ed1547e79
10 changed files with 408 additions and 64 deletions
+11 -5
View File
@@ -322,10 +322,10 @@ namespace SourceGen {
public SerLocalVariableTable() { }
public SerLocalVariableTable(LocalVariableTable varTab) {
Variables = new List<SerDefSymbol>(varTab.Variables.Count);
foreach (KeyValuePair<string, DefSymbol> kvp in varTab.Variables) {
// Note kvp.Key is redundant -- same as kvp.Value.Label
Variables.Add(new SerDefSymbol(kvp.Value));
Variables = new List<SerDefSymbol>(varTab.Count);
for (int i = 0; i < varTab.Count; i++) {
DefSymbol defSym = varTab[i];
Variables.Add(new SerDefSymbol(defSym));
}
ClearPrevious = varTab.ClearPrevious;
@@ -831,7 +831,13 @@ namespace SourceGen {
if (!CreateDefSymbol(serDef, contentVersion, report, out DefSymbol defSym)) {
return false;
}
outLvt.Variables.Add(defSym.Label, defSym);
if (defSym.SymbolSource != Symbol.Source.Variable) {
// not expected to happen
Debug.WriteLine("Found local variable with bad source: " +
defSym.SymbolSource);
continue;
}
outLvt.AddOrReplace(defSym);
}
return true;
}