Skip to content

Commit

Permalink
fix assembler crashing when labels aren't found
Browse files Browse the repository at this point in the history
  • Loading branch information
MESYETI committed Nov 17, 2023
1 parent 7a6541d commit 90db64d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions source/assembler/assembler.d
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,10 @@ class Assembler {
}

if (!valid) {
Error(
format(
"Parameter %d is invalid for instruction %s", i + 1,
inst.name
)
);
Error(format(
"Parameter %d is invalid for instruction %s", i + 1,
inst.name
));
exit(1);
}
}
Expand Down Expand Up @@ -448,6 +446,13 @@ class Assembler {
case NodeType.Identifier: {
auto paramNode = cast(IdentifierNode) param;

if (paramNode.name !in labels) {
Error(format(
"No such label: '%s'", paramNode.name
));
return;
}

addr = labels[paramNode.name];

string[] bsInstructions = [
Expand Down

0 comments on commit 90db64d

Please sign in to comment.