10
10
package org .jruby .truffle .nodes .core ;
11
11
12
12
import com .oracle .truffle .api .CompilerDirectives ;
13
+ import com .oracle .truffle .api .dsl .CreateCast ;
14
+ import com .oracle .truffle .api .dsl .NodeChild ;
13
15
import com .oracle .truffle .api .dsl .Specialization ;
14
16
import com .oracle .truffle .api .source .SourceSection ;
15
17
import com .oracle .truffle .api .utilities .ConditionProfile ;
20
22
import org .jcodings .util .CaseInsensitiveBytesHash ;
21
23
import org .jcodings .util .Hash ;
22
24
import org .jruby .runtime .encoding .EncodingService ;
25
+ import org .jruby .truffle .nodes .RubyNode ;
26
+ import org .jruby .truffle .nodes .coerce .ToStrNodeFactory ;
23
27
import org .jruby .truffle .runtime .RubyContext ;
24
28
import org .jruby .truffle .runtime .core .RubyArray ;
25
29
import org .jruby .truffle .runtime .core .RubyEncoding ;
@@ -224,7 +228,8 @@ public RubyNilClass defaultExternal(RubyNilClass encoding) {
224
228
}
225
229
226
230
@ CoreMethod (names = "find" , onSingleton = true , required = 1 )
227
- public abstract static class FindNode extends CoreMethodNode {
231
+ @ NodeChild (value = "name" )
232
+ public abstract static class FindNode extends RubyNode {
228
233
229
234
public FindNode (RubyContext context , SourceSection sourceSection ) {
230
235
super (context , sourceSection );
@@ -234,6 +239,10 @@ public FindNode(FindNode prev) {
234
239
super (prev );
235
240
}
236
241
242
+ @ CreateCast ("name" ) public RubyNode coerceNameToString (RubyNode name ) {
243
+ return ToStrNodeFactory .create (getContext (), getSourceSection (), name );
244
+ }
245
+
237
246
@ Specialization
238
247
public RubyEncoding find (RubyString name ) {
239
248
notDesignedForCompilation ();
0 commit comments