|
20 | 20 | import org.jruby.truffle.runtime.*; |
21 | 21 | import org.jruby.truffle.runtime.control.*; |
22 | 22 | import org.jruby.truffle.runtime.core.RubyBasicObject; |
23 | | -import org.jruby.truffle.runtime.core.RubyModule; |
24 | 23 |
|
25 | 24 | public class ReadConstantNode extends RubyNode { |
26 | 25 |
|
27 | | - private final boolean isLiteral; |
28 | | - private final String name; |
29 | | - @Child protected RubyNode receiver; |
| 26 | + protected final String name; |
| 27 | + @Child protected BoxingNode receiver; |
| 28 | + |
30 | 29 | @Child protected DispatchHeadNode dispatch; |
31 | 30 |
|
32 | | - public ReadConstantNode(RubyContext context, SourceSection sourceSection, boolean isLiteral, String name, RubyNode receiver) { |
| 31 | + public ReadConstantNode(RubyContext context, SourceSection sourceSection, String name, RubyNode receiver) { |
33 | 32 | super(context, sourceSection); |
34 | | - this.isLiteral = isLiteral; |
35 | 33 | this.name = name; |
36 | | - this.receiver = receiver; |
| 34 | + this.receiver = new BoxingNode(context, sourceSection, receiver); |
37 | 35 | dispatch = new DispatchHeadNode(context, Dispatch.MissingBehavior.CALL_CONST_MISSING); |
38 | 36 | } |
39 | 37 |
|
40 | 38 | @Override |
41 | 39 | public Object execute(VirtualFrame frame) { |
42 | | - final Object receiverObject = receiver.execute(frame); |
43 | | - |
44 | | - if (isLiteral && !(receiverObject instanceof RubyModule)) { |
45 | | - CompilerDirectives.transferToInterpreter(); |
46 | | - throw new RaiseException(getContext().getCoreLibrary().typeErrorIsNotA(receiverObject.toString(), "class/module", this)); |
47 | | - } |
48 | | - |
49 | 40 | return dispatch.dispatch( |
50 | 41 | frame, |
51 | 42 | NilPlaceholder.INSTANCE, |
52 | 43 | RubyArguments.getSelf(frame.getArguments()), |
53 | | - receiverObject, |
| 44 | + receiver.executeRubyBasicObject(frame), |
54 | 45 | name, |
55 | 46 | null, |
56 | 47 | new Object[]{}, |
|
0 commit comments