Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2bab6f98fbdb
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 53342fbf89d3
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jun 2, 2015

  1. removed redundant modifier.

    nirvdrum committed Jun 2, 2015
    Copy the full SHA
    27b4cc1 View commit details
  2. Copy the full SHA
    53342fb View commit details
Showing with 4 additions and 9 deletions.
  1. +4 −9 core/src/main/java/org/jruby/RubyRegexp.java
13 changes: 4 additions & 9 deletions core/src/main/java/org/jruby/RubyRegexp.java
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@
import org.joni.Regex;
import org.joni.Region;
import org.joni.Syntax;
import org.joni.exception.ErrorMessages;
import org.joni.exception.JOniException;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
@@ -300,7 +299,7 @@ private RubyRegexp(Ruby runtime, ByteList str) {
this(runtime);
str.getClass();
this.str = str;
this.pattern = getRegexpFromCache(runtime, str, getEncoding(runtime, str), RegexpOptions.NULL_OPTIONS);
this.pattern = getRegexpFromCache(runtime, str, str.getEncoding(), RegexpOptions.NULL_OPTIONS);
}

private RubyRegexp(Ruby runtime, ByteList str, RegexpOptions options) {
@@ -310,10 +309,6 @@ private RubyRegexp(Ruby runtime, ByteList str, RegexpOptions options) {
initializeCommon19(str, str.getEncoding(), options);
}

private Encoding getEncoding(Ruby runtime, ByteList str) {
return str.getEncoding();
}

// used only by the compiler/interpreter (will set the literal flag)
public static RubyRegexp newRegexp(Ruby runtime, String pattern, RegexpOptions options) {
return newRegexp(runtime, ByteList.create(pattern), options);
@@ -451,7 +446,7 @@ public final Regex preparePattern(RubyString str) {
return getPreprocessedRegexpFromCache(getRuntime(), this.str, enc, options, ErrorMode.PREPROCESS);
}

private static enum ErrorMode {RAISE, PREPROCESS, DESC}
private enum ErrorMode {RAISE, PREPROCESS, DESC}

private static int raisePreprocessError(Ruby runtime, ByteList str, String err, ErrorMode mode) {
switch (mode) {
@@ -1755,7 +1750,7 @@ public IRubyObject to_s() {

if (bytes[p] == ':' && bytes[p + len - 1] == ')') {
try {
new Regex(bytes, ++p, p + (len -= 2), Option.DEFAULT, getEncoding(runtime, str), Syntax.DEFAULT);
new Regex(bytes, ++p, p + (len -= 2), Option.DEFAULT, str.getEncoding(), Syntax.DEFAULT);
err = false;
} catch (JOniException e) {
err = true;
@@ -1778,7 +1773,7 @@ public IRubyObject to_s() {
if (!newOptions.isExtended()) result.append((byte)'x');
}
result.append((byte)':');
appendRegexpString19(runtime, result, bytes, p, len, getEncoding(runtime, str), null);
appendRegexpString19(runtime, result, bytes, p, len, str.getEncoding(), null);

result.append((byte)')');
return RubyString.newString(getRuntime(), result, getEncoding()).infectBy(this);