|
37 | 37 | abstract class TruffleCompiler {
|
38 | 38 | public void run(SixModelObject node, ThreadContext tc) {
|
39 | 39 | FrameDescriptor frameDescriptor = new FrameDescriptor();
|
40 |
| - RootNode rootNode = new NQPRootNode(null, frameDescriptor, build(node, new NQPScopeWithFrame(frameDescriptor, null), tc)); |
| 40 | + RootNode rootNode = new NQPRootNode(null, frameDescriptor, tastToNode(node, new NQPScopeWithFrame(frameDescriptor, null), tc)); |
41 | 41 |
|
42 | 42 |
|
43 | 43 | CallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
|
44 | 44 | callTarget.call();
|
45 | 45 | }
|
46 | 46 |
|
47 |
| - protected NQPNode[] expressions(SixModelObject node, int from, NQPScope scope, ThreadContext tc) { |
| 47 | + protected NQPNode[] tastToNodeArray(SixModelObject node, int from, NQPScope scope, ThreadContext tc) { |
48 | 48 | int elems = (int) node.elems(tc);
|
49 | 49 | NQPNode children[] = new NQPNode[elems - from];
|
50 | 50 | for (int i = from; i < elems; i++) {
|
51 |
| - children[i-from] = build(node.at_pos_boxed(tc, i), scope, tc); |
| 51 | + children[i-from] = tastToNode(node.at_pos_boxed(tc, i), scope, tc); |
52 | 52 | }
|
53 | 53 | return children;
|
54 | 54 | }
|
55 | 55 |
|
56 |
| - abstract protected NQPNode buildSimple(SixModelObject node, NQPScope scope, ThreadContext tc); |
57 |
| - |
58 |
| - public NQPNode build(SixModelObject node, NQPScope scope, ThreadContext tc) { |
59 |
| - NQPNode trySimple = buildSimple(node, scope, tc); |
60 |
| - if (trySimple != null) return trySimple; |
61 |
| - |
62 |
| - switch (node.at_pos_boxed(tc, 0).get_str(tc)) { |
63 |
| - default: |
64 |
| - throw new IllegalArgumentException("Wrong node type: " + node.at_pos_boxed(tc, 0).get_str(tc)); |
65 |
| - } |
66 |
| - } |
| 56 | + abstract protected NQPNode tastToNode(SixModelObject node, NQPScope scope, ThreadContext tc); |
67 | 57 |
|
68 | 58 | @Predeserializer("block")
|
69 | 59 | public static NQPScope createNewScope(NQPScope scope) {
|
|
0 commit comments