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: deee6cc039a1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b70c8f5c16e9
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Jan 11, 2018

  1. Copy the full SHA
    ccac3db View commit details
  2. Copy the full SHA
    72be3db View commit details
  3. Copy the full SHA
    d6ef4a3 View commit details
  4. Copy the full SHA
    a77b77b View commit details
  5. Copy the full SHA
    b70c8f5 View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyRegexp.java
Original file line number Diff line number Diff line change
@@ -1604,7 +1604,7 @@ private static final int ASCGET(boolean acompat, byte[] sBytes, int s, int e, in
}

// rb_reg_regsub
static RubyString regsub19(ThreadContext context, RubyString str, RubyString src, Matcher matcher, Regex pattern) {
static RubyString regsub(ThreadContext context, RubyString str, RubyString src, Matcher matcher, Regex pattern) {
Ruby runtime = context.runtime;

RubyString val = null;
100 changes: 50 additions & 50 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -2529,7 +2529,7 @@ private IRubyObject subBangIter(Ruby runtime, ThreadContext context, IRubyObject
Encoding enc = value.getEncoding();
final Matcher matcher = prepared.matcher(bytes, begin, range);

if (RubyRegexp.matcherSearch(runtime, matcher, begin, range, Option.NONE) >= 0) {
if (RubyRegexp.matcherSearch(context, matcher, begin, range, Option.NONE) >= 0) {
RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern);
match.regexp = regexp;
context.setBackRef(match);
@@ -2550,7 +2550,7 @@ private IRubyObject subBangIter(Ruby runtime, ThreadContext context, IRubyObject

return subBangCommon(context, mBeg, mEnd, repl, tuFlags | repl.flags);
}
return context.setBackRef(runtime.getNil());
return context.setBackRef(context.nil);
}

private IRubyObject subBangNoIter(Ruby runtime, ThreadContext context, IRubyObject arg0, RubyString repl) {
@@ -2563,7 +2563,7 @@ private IRubyObject subBangNoIter(Ruby runtime, ThreadContext context, IRubyObje
final Matcher matcher = prepared.matcher(value.getUnsafeBytes(), begin, range);

if (RubyRegexp.matcherSearch(context, matcher, begin, range, Option.NONE) >= 0) {
repl = RubyRegexp.regsub19(context, repl, this, matcher, pattern);
repl = RubyRegexp.regsub(context, repl, this, matcher, pattern);
RubyMatchData match = RubyRegexp.createMatchData(context, this, matcher, pattern);
match.regexp = regexp;
context.setBackRef(match);
@@ -2629,60 +2629,60 @@ private Encoding subBangVerifyEncoding(ThreadContext context, final RubyString r
return repl.value.getEncoding();
}

/** rb_str_gsub / rb_str_gsub_bang
*
*/
public IRubyObject gsub(ThreadContext context, IRubyObject arg0, Block block) {
return gsub19(context, arg0, block);
@Deprecated
public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, Block block) {
return gsub(context, arg0, block);
}

public IRubyObject gsub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsub19(context, arg0, arg1, block);
@Deprecated
public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsub(context, arg0, arg1, block);
}

public IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, Block block) {
return gsub_bang19(context, arg0, block);
@Deprecated
public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, Block block) {
return gsub_bang(context, arg0, block);
}

public IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsub_bang19(context, arg0, arg1, block);
@Deprecated
public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsub_bang(context, arg0, arg1, block);
}

@JRubyMethod(name = "gsub", reads = BACKREF, writes = BACKREF)
public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, Block block) {
public IRubyObject gsub(ThreadContext context, IRubyObject arg0, Block block) {
return block.isGiven() ? gsubCommon19(context, block, null, null, arg0, false, 0) : enumeratorize(context.runtime, this, "gsub", arg0);
}

@JRubyMethod(name = "gsub", reads = BACKREF, writes = BACKREF)
public IRubyObject gsub19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsub19(context, arg0, arg1, block, false);
public IRubyObject gsub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
return gsubImpl(context, arg0, arg1, block, false);
}

@JRubyMethod(name = "gsub!", reads = BACKREF, writes = BACKREF)
public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, Block block) {
public IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, Block block) {
checkFrozen();
return block.isGiven() ? gsubCommon19(context, block, null, null, arg0, true, 0) : enumeratorize(context.runtime, this, "gsub!", arg0);
}

@JRubyMethod(name = "gsub!", reads = BACKREF, writes = BACKREF)
public IRubyObject gsub_bang19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
public IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block) {
checkFrozen();
return gsub19(context, arg0, arg1, block, true);
return gsubImpl(context, arg0, arg1, block, true);
}

private IRubyObject gsub19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block, final boolean bang) {
Ruby runtime = context.runtime;
IRubyObject tryHash = TypeConverter.convertToTypeWithCheck(context, arg1, runtime.getHash(), sites(context).to_hash_checked);
private IRubyObject gsubImpl(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block, final boolean bang) {
IRubyObject tryHash = TypeConverter.convertToTypeWithCheck(context, arg1, context.runtime.getHash(), sites(context).to_hash_checked);

final RubyHash hash;
final RubyString str;
final int tuFlags;
if (tryHash.isNil()) {
if (tryHash == context.nil) {
hash = null;
str = arg1.convertToString();
tuFlags = str.flags;
} else {
hash = (RubyHash)tryHash;
hash = (RubyHash) tryHash;
str = null;
tuFlags = hash.flags & TAINTED_F;
}
@@ -2729,7 +2729,7 @@ private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString
int endz = matcher.getEnd();

if (repl != null) { // string given
val = RubyRegexp.regsub19(context, repl, this, matcher, pattern);
val = RubyRegexp.regsub(context, repl, this, matcher, pattern);
} else {
final RubyString substr = makeShared(runtime, begz, endz - begz);
if (hash != null) { // hash given
@@ -2782,34 +2782,35 @@ private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString
/** rb_str_index_m
*
*/
public IRubyObject index(ThreadContext context, IRubyObject arg0) {
return index19(context, arg0);
}

public IRubyObject index(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
return index19(context, arg0, arg1);
}

@JRubyMethod(name = "index", reads = BACKREF, writes = BACKREF)
public IRubyObject index19(ThreadContext context, IRubyObject arg0) {
return indexCommon19(context.runtime, context, arg0, 0);
public IRubyObject index(ThreadContext context, IRubyObject arg0) {
return indexCommon19(context, arg0, 0);
}

@JRubyMethod(name = "index", reads = BACKREF, writes = BACKREF)
public IRubyObject index19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
public IRubyObject index(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
int pos = RubyNumeric.num2int(arg1);
Ruby runtime = context.runtime;
if (pos < 0) {
pos += strLength();
if (pos < 0) {
if (arg0 instanceof RubyRegexp) context.setBackRef(runtime.getNil());
return runtime.getNil();
if (arg0 instanceof RubyRegexp) context.setBackRef(context.nil);
return context.nil;
}
}
return indexCommon19(runtime, context, arg0, pos);
return indexCommon19(context, arg0, pos);
}

@Deprecated
public IRubyObject index19(ThreadContext context, IRubyObject arg0) {
return index(context, arg0);
}

@Deprecated
public IRubyObject index19(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
return index(context, arg0, arg1);
}

private IRubyObject indexCommon19(Ruby runtime, ThreadContext context, IRubyObject sub, int pos) {
private IRubyObject indexCommon19(ThreadContext context, IRubyObject sub, int pos) {
if (sub instanceof RubyRegexp) {
if (pos > strLength()) return context.nil;
RubyRegexp regSub = (RubyRegexp) sub;
@@ -2825,12 +2826,12 @@ private IRubyObject indexCommon19(Ruby runtime, ThreadContext context, IRubyObje
pos = subLength(pos);
} else {
IRubyObject tmp = sub.checkStringType();
if (tmp.isNil()) throw runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
if (tmp == context.nil) throw context.runtime.newTypeError("type mismatch: " + sub.getMetaClass().getName() + " given");
pos = StringSupport.index(this, (RubyString) tmp, pos, this.checkEncoding((RubyString) tmp));
pos = subLength(pos);
}

return pos == -1 ? runtime.getNil() : RubyFixnum.newFixnum(runtime, pos);
return pos == -1 ? context.nil : RubyFixnum.newFixnum(context.runtime, pos);
}

// MRI: rb_strseq_index
@@ -3020,7 +3021,7 @@ public final IRubyObject substr19(Ruby runtime, int beg, int len) {
}
if (beg + len > length) len = length - beg;
if (len <= 0) len = beg = 0;
return makeShared19(runtime, beg, len);
return makeShared(runtime, beg, len);
} else {
if (beg + len > length) len = length - beg;
return multibyteSubstr19(runtime, enc, len, beg, length);
@@ -3078,8 +3079,6 @@ private IRubyObject multibyteSubstr19(Ruby runtime, Encoding enc, int len, int b
/* rb_str_splice */
private IRubyObject replaceInternal(int beg, int len, RubyString repl) {
StringSupport.replaceInternal(beg, len, this, repl);

// TODO (nirvdrum 13-Jan-15) This should be part of the StringSupport definition but a general notion of tainted needs to emerge first.
return infectBy(repl);
}

@@ -5330,13 +5329,14 @@ private RubySymbol checkSpecialCasesIntern(ByteList value) {
return null;
}

@JRubyMethod(name = {"to_sym", "intern"})
public RubySymbol intern() {
return intern19();
return to_sym();
}

@JRubyMethod(name = {"to_sym", "intern"})
@Deprecated
public RubySymbol intern19() {
return to_sym();
return intern();
}

@JRubyMethod
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/runtime/Frame.java
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ public final class Frame {
private IRubyObject lastLine;

/** whether this frame has been captured into a binding **/
private boolean captured;
boolean captured;

/** A dummy frame **/
public static final Frame DUMMY = new Frame();
Loading