@@ -488,9 +488,9 @@ private static int nameToBackrefNumber(Ruby runtime, Regex pattern, Region regs,
488
488
}
489
489
}
490
490
491
- public final int backrefNumber (IRubyObject obj ) {
491
+ public final int backrefNumber (Ruby runtime , IRubyObject obj ) {
492
492
check ();
493
- return backrefNumber (getRuntime () , getPattern (), regs , obj );
493
+ return backrefNumber (runtime , getPattern (), regs , obj );
494
494
}
495
495
496
496
public static int backrefNumber (Ruby runtime , Regex pattern , Region regs , IRubyObject obj ) {
@@ -630,11 +630,10 @@ public IRubyObject size(ThreadContext context) {
630
630
*/
631
631
@ JRubyMethod
632
632
public IRubyObject begin (ThreadContext context , IRubyObject index ) {
633
- Ruby runtime = context .runtime ;
634
-
635
- int i = backrefNumber (index );
636
-
637
633
check ();
634
+ final Ruby runtime = context .runtime ;
635
+ final int i = backrefNumber (runtime , index );
636
+
638
637
if (i < 0 || (regs == null ? 1 : regs .numRegs ) <= i ) {
639
638
throw runtime .newIndexError ("index " + i + " out of matches" );
640
639
}
@@ -656,7 +655,7 @@ public IRubyObject end(ThreadContext context, IRubyObject index) {
656
655
check ();
657
656
658
657
final Ruby runtime = context .runtime ;
659
- final int i = backrefNumber (index );
658
+ final int i = backrefNumber (runtime , index );
660
659
661
660
if (i < 0 || (regs == null ? 1 : regs .numRegs ) <= i ) {
662
661
throw runtime .newIndexError ("index " + i + " out of matches" );
@@ -686,11 +685,12 @@ public IRubyObject offset19(ThreadContext context, IRubyObject index) {
686
685
check ();
687
686
688
687
final Ruby runtime = context .runtime ;
689
- final int i = backrefNumber (index );
688
+ final int i = backrefNumber (runtime , index );
690
689
691
690
if (i < 0 || (regs == null ? 1 : regs .numRegs ) <= i ) {
692
691
throw runtime .newIndexError ("index " + i + " out of matches" );
693
692
}
693
+
694
694
int b , e ;
695
695
if (regs == null ) {
696
696
b = begin ;
0 commit comments