Skip to content

Commit

Permalink
Merge pull request jruby#8417 from enebo/triv_parse
Browse files Browse the repository at this point in the history
Trivial refactoring for match
  • Loading branch information
enebo authored Nov 10, 2024
2 parents a0650ab + f45430d commit c679b93
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/ir/builder/IRBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1734,11 +1734,10 @@ protected Variable buildDefnCheckIfThenPaths(Label undefLabel, Operand defVal) {
}

public Operand buildMatch(Variable result, Operand regexp) {
Variable tempLastLine = temp();
addResultInstr(new GetGlobalVariableInstr(tempLastLine, symbol("$_")));
Variable lastLine = addResultInstr(new GetGlobalVariableInstr(temp(), symbol("$_")));

if (result == null) result = temp();
return addResultInstr(new MatchInstr(scope, result, regexp, tempLastLine));
return addResultInstr(new MatchInstr(scope, result, regexp, lastLine));
}

protected Operand buildModule(ByteList name, U cpath, U bodyNode, StaticScope scope, int line, int endLine) {
Expand Down

0 comments on commit c679b93

Please sign in to comment.