Skip to content

Commit

Permalink
fix: Do not add instruction mapping with null keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Aug 25, 2024
1 parent ce9e3db commit 0090a03
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,15 @@ public void markTerminal(int index, @NotNull F frame) {
}

@Override
public void recordInstructionMapping(@NotNull ASTInstruction instruction, @NotNull CodeElement element) {
public void recordInstructionMapping(@Nullable ASTInstruction instruction, @NotNull CodeElement element) {
// Map code element to AST it originates from.
elementToAst.put(element, instruction);
astToElement.put(instruction, element);

// Not all code elements have an associated AST.
// In some cases we will insert things like additional labels.
// We do not want to have nay null keys.
if (instruction != null)
astToElement.put(instruction, element);
}

@Override
Expand Down

0 comments on commit 0090a03

Please sign in to comment.