1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-28 16:31:17 +00:00

Fix symbol entry bug in operand editors

The un-trimmed symbol was being used, so labels entered with
annotation characters (e.g. "FOO?") were failing to be found.
This commit is contained in:
Andy McFadden 2019-12-25 19:14:51 -08:00
parent 9a6e87f496
commit a9913b8b69
3 changed files with 6 additions and 7 deletions

View File

@ -328,7 +328,8 @@ namespace SourceGen {
/// <param name="hasNonUniquePrefix">True if the first character indicates that this is
/// a non-unique label.</param>
/// <param name="anno">Annotation found, or None if none found.</param>
/// <returns>Trimmed version of the string.</returns>
/// <returns>Trimmed version of the string, or the original string if an error
/// is encountered.</returns>
public static string TrimAndValidateLabel(string label, string nonUniquePrefix,
out bool isValid, out bool isLenValid, out bool isFirstCharValid,
out bool hasNonUniquePrefix, out LabelAnnotation anno) {

View File

@ -1026,13 +1026,13 @@ namespace SourceGen.WpfGui {
Symbol osym = mProject.FindBestNonUniqueLabel(trimLabel, matchOffset);
if (osym != null) {
weakLabel = osym.Label;
trimLabel = osym.Label;
} else {
Debug.WriteLine("Attempt to create ref to nonexistant non-unique sym");
subType = FormatDescriptor.SubType.Hex;
}
}
symbolRef = new WeakSymbolRef(weakLabel, part);
symbolRef = new WeakSymbolRef(trimLabel, part);
} else {
Debug.Assert(false);
}

View File

@ -716,8 +716,6 @@ namespace SourceGen.WpfGui {
part = WeakSymbolRef.Part.Low;
}
string weakLabel = SymbolLabel;
// Deal with non-unique labels. If the label refers to an existing
// symbol, use its label, which will have the tag. If the label doesn't
// have a match, discard it -- we don't support weak refs to ambiguous
@ -728,7 +726,7 @@ namespace SourceGen.WpfGui {
out Symbol.LabelAnnotation unused3);
if (isValid && hasNonUniquePrefix) {
if (LookupSymbol(trimLabel, hasNonUniquePrefix, out Symbol sym)) {
weakLabel = sym.Label;
trimLabel = sym.Label;
} else {
Debug.WriteLine("Attempt to create ref to non-existant non-unique sym");
return null;
@ -736,7 +734,7 @@ namespace SourceGen.WpfGui {
}
return FormatDescriptor.Create(instructionLength,
new WeakSymbolRef(weakLabel, part), false);
new WeakSymbolRef(trimLabel, part), false);
}
FormatDescriptor.SubType subType;