From f45430db439f2d5a81415ac766dfef6c88a4dca1 Mon Sep 17 00:00:00 2001 From: "Thomas E. Enebo" Date: Sun, 10 Nov 2024 14:31:12 -0600 Subject: [PATCH] Trivial refactoring for match --- core/src/main/java/org/jruby/ir/builder/IRBuilder.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/jruby/ir/builder/IRBuilder.java b/core/src/main/java/org/jruby/ir/builder/IRBuilder.java index db463dcc73c..c8cbdcda554 100644 --- a/core/src/main/java/org/jruby/ir/builder/IRBuilder.java +++ b/core/src/main/java/org/jruby/ir/builder/IRBuilder.java @@ -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) {