|
31 | 31 | import org.truffleruby.core.proc.RubyProc;
|
32 | 32 | import org.truffleruby.core.range.RubyIntRange;
|
33 | 33 | import org.truffleruby.core.rope.Rope;
|
| 34 | +import org.truffleruby.core.rope.RopeOperations; |
34 | 35 | import org.truffleruby.core.string.CoreStrings;
|
35 | 36 | import org.truffleruby.core.string.RubyString;
|
36 | 37 | import org.truffleruby.core.string.StringOperations;
|
37 | 38 | import org.truffleruby.core.string.StringUtils;
|
38 | 39 | import org.truffleruby.core.symbol.RubySymbol;
|
39 | 40 | import org.truffleruby.core.thread.ThreadNodes.ThreadGetExceptionNode;
|
40 |
| -import org.truffleruby.core.string.ImmutableRubyString; |
41 | 41 | import org.truffleruby.language.Nil;
|
42 | 42 | import org.truffleruby.language.backtrace.Backtrace;
|
43 | 43 | import org.truffleruby.language.backtrace.BacktraceFormatter;
|
@@ -237,12 +237,8 @@ public RubyException argumentErrorWrongArgumentType(Object object, String expect
|
237 | 237 | }
|
238 | 238 |
|
239 | 239 | @TruffleBoundary
|
240 |
| - public RubyException argumentErrorInvalidStringToInteger(Object object, Node currentNode) { |
241 |
| - assert object instanceof RubyString || object instanceof ImmutableRubyString; |
242 |
| - // TODO (nirvdrum 19-Apr-18): Guard against String#inspect being redefined to return something other than a String. |
243 |
| - final String formattedObject = RubyStringLibrary |
244 |
| - .getUncached() |
245 |
| - .getJavaString(RubyContext.send(object, "inspect")); |
| 240 | + public RubyException argumentErrorInvalidStringToInteger(Rope rope, Node currentNode) { |
| 241 | + final String formattedObject = RopeOperations.decodeRope(rope); |
246 | 242 | return argumentError(StringUtils.format("invalid value for Integer(): %s", formattedObject), currentNode);
|
247 | 243 | }
|
248 | 244 |
|
|
0 commit comments