Skip to content

Commit

Permalink
Use original program when constructing ProgramStatement.
Browse files Browse the repository at this point in the history
This means that ProgramStatements now refer to the file they actually
occur in, like is the case for the original SourceLine.  This is used
for various diagnostics messages.

Fixes #160.
  • Loading branch information
athas committed Sep 23, 2022
1 parent 27a7c1f commit 4af4a40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rars/assembler/Assembler.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ private ArrayList<ProgramStatement> parseLine(TokenList tokenList, String source
"Extended (pseudo) instruction or format not permitted. See Settings."));
}
if (OperandFormat.tokenOperandMatch(tokens, inst, errors)) {
programStatement = new ProgramStatement(this.fileCurrentlyBeingAssembled, source,
programStatement = new ProgramStatement(token.getOriginalProgram(), source,
tokenList, tokens, inst, textAddress.get(), sourceLineNumber);
// instruction length is 4 for all basic instruction, varies for extended instruction
// Modified to permit use of compact expansion if address fits
Expand Down
2 changes: 1 addition & 1 deletion src/rars/assembler/SourceLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ public int getLineNumber() {
public RISCVprogram getRISCVprogram() {
return program;
}
}
}

0 comments on commit 4af4a40

Please sign in to comment.