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

Commits on Feb 16, 2015

  1. Copy the full SHA
    c1091bd View commit details
  2. Copy the full SHA
    eaff186 View commit details
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/string/valid_encoding_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
fails:String#valid_encoding? returns true if the String's encoding is valid
fails:String#valid_encoding? returns true if self is valid in the current encoding and other encodings
fails:String#valid_encoding? returns true for all encodings self is valid in
fails:String#valid_encoding? returns false if self is valid in one encoding, but invalid in the one it's tagged with
fails:String#valid_encoding? returns false if self contains a character invalid in the associated encoding
fails:String#valid_encoding? returns false if a valid String had an invalid character appended to it
Original file line number Diff line number Diff line change
@@ -1864,6 +1864,24 @@ public RubyString upcaseBang(RubyString string) {
}
}

@CoreMethod(names = "valid_encoding?")
public abstract static class ValidEncodingQueryNode extends CoreMethodNode {

public ValidEncodingQueryNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public ValidEncodingQueryNode(ValidEncodingQueryNode prev) {
super(prev);
}

@Specialization
public boolean validEncodingQuery(RubyString string) {
return string.scanForCodeRange() != StringSupport.CR_BROKEN;
}

}

@CoreMethod(names = "capitalize!")
public abstract static class CapitalizeBangNode extends CoreMethodNode {

Original file line number Diff line number Diff line change
@@ -178,11 +178,12 @@ public int getCodeRange() {
}

@Override
@TruffleBoundary
public int scanForCodeRange() {
int cr = getCodeRange();

if (cr == StringSupport.CR_UNKNOWN) {
cr = StringSupport.codeRangeScan(bytes.getEncoding(), bytes);
cr = slowCodeRangeScan();
setCodeRange(cr);
}

@@ -231,4 +232,9 @@ public RubyBasicObject allocate(RubyContext context, RubyClass rubyClass, RubyNo

}

@TruffleBoundary
private int slowCodeRangeScan() {
return StringSupport.codeRangeScan(bytes.getEncoding(), bytes);
}

}