Skip to content

Commit

Permalink
[Truffle] Commit a method rename that I missed earlier.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Feb 3, 2015
1 parent 08d573a commit fc18a10
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -9,10 +9,12 @@
*/
package org.jruby.truffle.runtime.core;

import org.joni.Regex;
import org.joni.Region;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.subsystems.ObjectSpaceManager;
import org.jruby.truffle.runtime.util.ArrayUtils;
import org.jruby.util.ByteList;

import java.util.Arrays;

Expand All @@ -21,14 +23,16 @@
*/
public class RubyMatchData extends RubyBasicObject {

private Region region;
private final Regex regex;
private final Region region;
private final Object[] values;
private final RubyString pre;
private final RubyString post;
private final RubyString global;

public RubyMatchData(RubyClass rubyClass, Region region, Object[] values, RubyString pre, RubyString post, RubyString global) {
public RubyMatchData(RubyClass rubyClass, Regex regex, Region region, Object[] values, RubyString pre, RubyString post, RubyString global) {
super(rubyClass);
this.regex = regex;
this.region = region;
this.values = values;
this.pre = pre;
Expand Down Expand Up @@ -90,6 +94,10 @@ public int getNumberOfRegions() {
return region.numRegs;
}

public int getBackrefNumber(ByteList value) {
return regex.nameToBackrefNumber(value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize(), region);
}

@Override
public void visitObjectGraphChildren(ObjectSpaceManager.ObjectGraphVisitor visitor) {
for (Object object : values) {
Expand Down

0 comments on commit fc18a10

Please sign in to comment.