File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
src/main/java/org/truffleruby/language Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
package org .truffleruby .language ;
11
11
12
+ import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
12
13
import org .truffleruby .RubyContext ;
13
14
import org .truffleruby .RubyLanguage ;
14
15
import org .truffleruby .cext .ValueWrapper ;
@@ -89,8 +90,11 @@ public Class<RubyLanguage> getLanguage() {
89
90
return RubyLanguage .class ;
90
91
}
91
92
93
+ @ TruffleBoundary
92
94
@ ExportMessage
93
- public abstract String toDisplayString (boolean allowSideEffects );
95
+ public String toDisplayString (boolean allowSideEffects ) {
96
+ throw new AbstractMethodError ();
97
+ }
94
98
95
99
// region Members
96
100
@ ExportMessage
Original file line number Diff line number Diff line change 17
17
import com .oracle .truffle .api .library .ExportMessage ;
18
18
import org .truffleruby .RubyContext ;
19
19
import org .truffleruby .RubyLanguage ;
20
+ import org .truffleruby .core .kernel .KernelNodes ;
20
21
import org .truffleruby .core .klass .RubyClass ;
21
22
import org .truffleruby .core .rope .LeafRope ;
22
23
import org .truffleruby .core .rope .Rope ;
23
24
import org .truffleruby .core .rope .RopeOperations ;
24
25
import org .truffleruby .interop .ToJavaStringNode ;
26
+ import org .truffleruby .language .dispatch .DispatchNode ;
25
27
import org .truffleruby .language .library .RubyStringLibrary ;
26
28
27
29
@@ -59,10 +61,15 @@ public String getJavaString() {
59
61
// endregion
60
62
61
63
// region InteropLibrary messages
62
- @ Override
63
64
@ ExportMessage
64
- public String toDisplayString (boolean allowSideEffects ) {
65
- return RopeOperations .decodeRope (rope );
65
+ public Object toDisplayString (boolean allowSideEffects ,
66
+ @ Cached DispatchNode dispatchNode ,
67
+ @ Cached KernelNodes .ToSNode kernelToSNode ) {
68
+ if (allowSideEffects ) {
69
+ return dispatchNode .call (this , "inspect" );
70
+ } else {
71
+ return kernelToSNode .executeToS (this );
72
+ }
66
73
}
67
74
68
75
@ ExportMessage
You can’t perform that action at this time.
0 commit comments