Skip to content

Commit 0e9c363

Browse files
razetimeeregon
authored andcommitted
use ToJavaStringNode for NoMatchingPatternError
1 parent 79d3394 commit 0e9c363

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/truffleruby/language/control/CheckIfPatternsMatchedNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12+
import org.truffleruby.interop.ToJavaStringNode;
1213
import org.truffleruby.language.RubyContextSourceNode;
1314

1415
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -17,14 +18,16 @@
1718
public final class CheckIfPatternsMatchedNode extends RubyContextSourceNode {
1819

1920
@Child RubyNode inspected;
21+
@Child ToJavaStringNode toJavaStringNode;
2022

2123
public CheckIfPatternsMatchedNode(RubyNode inspected) {
2224
this.inspected = inspected;
2325
}
2426

2527
@Override
2628
public Object execute(VirtualFrame frame) {
27-
String message = inspected.execute(frame).toString();
29+
toJavaStringNode = ToJavaStringNode.create(inspected);
30+
String message = (String) toJavaStringNode.execute(frame);
2831
throw new RaiseException(getContext(), coreExceptions().noMatchingPatternError(message, this));
2932
}
3033

0 commit comments

Comments
 (0)