Skip to content

Commit

Permalink
[Truffle] Removed the old Java-based String#to_i now that we have the…
Browse files Browse the repository at this point in the history
… Rubinius one.
  • Loading branch information
nirvdrum committed Mar 9, 2015
1 parent b2e4287 commit a13b32e
Showing 1 changed file with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1685,37 +1685,6 @@ public double toF(RubyString string) {
}
}

@CoreMethod(names = "to_i")
public abstract static class ToINode extends CoreMethodNode {

@Child private FixnumOrBignumNode fixnumOrBignum;

public ToINode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
fixnumOrBignum = new FixnumOrBignumNode(context, sourceSection);
}

public ToINode(ToINode prev) {
super(prev);
fixnumOrBignum = prev.fixnumOrBignum;
}

@Specialization
public Object toI(RubyString string) {
notDesignedForCompilation();

if (string.toString().length() == 0) {
return 0;
}

try {
return Integer.parseInt(string.toString());
} catch (NumberFormatException e) {
return fixnumOrBignum.fixnumOrBignum(new BigInteger(string.toString()));
}
}
}

@CoreMethod(names = { "to_s", "to_str" })
public abstract static class ToSNode extends CoreMethodNode {

Expand Down

0 comments on commit a13b32e

Please sign in to comment.