1
0
mirror of https://github.com/ksherlock/x65.git synced 2025-08-08 11:25:02 +00:00

Fixed scoped labels turning into local labels and expiring when endscope is encountered

This commit is contained in:
Carl-Henrik Skårstedt
2020-01-08 18:59:06 -08:00
parent a3f8a7cf44
commit 12e158d637

View File

@@ -4165,7 +4165,8 @@ StatusCode Asm::AddressLabel(strref label)
pLabel->constant = constLabel; pLabel->constant = constLabel;
last_label = label; last_label = label;
bool local = label[0]=='.' || label[0]=='@' || label[0]=='!' || label[0]==':' || label.get_last()=='$'; bool local = label[0]=='.' || label[0]=='@' || label[0]=='!' || label[0]==':' || label.get_last()=='$';
LabelAdded(pLabel, local || directive_scope_depth>0); // TODO: in named scopes the label can still be referenced outside the scope directive if (directive_scope_depth > 0) { local = true; }
LabelAdded(pLabel, local); // TODO: in named scopes the label can still be referenced outside the scope directive
if (local) { MarkLabelLocal(label); } if (local) { MarkLabelLocal(label); }
status = CheckLateEval(label); status = CheckLateEval(label);
if (!local && label[0]!=']') { // MERLIN: Variable label does not invalidate local labels if (!local && label[0]!=']') { // MERLIN: Variable label does not invalidate local labels
@@ -5383,11 +5384,11 @@ StatusCode Asm::ApplyDirective(AssemblerDirective dir, strref line, strref sourc
case AD_SCOPE: case AD_SCOPE:
directive_scope_depth++; directive_scope_depth++;
break; return EnterScope();
case AD_ENDSCOPE: case AD_ENDSCOPE:
directive_scope_depth--; directive_scope_depth--;
break; return ExitScope();
case AD_DS: case AD_DS:
return Directive_DS(line); return Directive_DS(line);