Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.codegen.test/src/com/oracle/truffle/api/codegen/test/BuiltinTest.java @ 9223:5f7f0d3e3638
Updated codegen tests to new codegen API.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Sat, 20 Apr 2013 12:17:47 +0200 |
parents | 6ef9fc7375c7 |
children | e27f125147d6 |
comparison
equal
deleted
inserted
replaced
9222:aa9ffb3a715e | 9223:5f7f0d3e3638 |
---|---|
30 import com.oracle.truffle.api.codegen.*; | 30 import com.oracle.truffle.api.codegen.*; |
31 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrAccessContextFactory; | 31 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrAccessContextFactory; |
32 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrConcatFactory; | 32 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrConcatFactory; |
33 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrLengthFactory; | 33 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrLengthFactory; |
34 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrSubstrFactory; | 34 import com.oracle.truffle.api.codegen.test.BuiltinTestFactory.StrFactory.StrSubstrFactory; |
35 import com.oracle.truffle.api.codegen.test.TypeSystemTest.ChildrenNode; | |
36 import com.oracle.truffle.api.codegen.test.TypeSystemTest.TestRootNode; | 35 import com.oracle.truffle.api.codegen.test.TypeSystemTest.TestRootNode; |
37 import com.oracle.truffle.api.codegen.test.TypeSystemTest.ValueNode; | 36 import com.oracle.truffle.api.codegen.test.TypeSystemTest.ValueNode; |
38 | 37 |
39 public class BuiltinTest { | 38 public class BuiltinTest { |
40 | 39 |
95 assertSame(context, node.getNode().getContext()); | 94 assertSame(context, node.getNode().getContext()); |
96 // accessible by execution | 95 // accessible by execution |
97 assertSame(context, executeWith(node)); | 96 assertSame(context, executeWith(node)); |
98 } | 97 } |
99 | 98 |
100 @NodeClass(BuiltinNode.class) | 99 @NodeClass(value = BuiltinNode.class, splitByMethodName = true) |
101 static class Str { | 100 static class Str { |
102 | 101 |
103 private final String internal; | 102 private final String internal; |
104 | 103 |
105 public Str(String internal) { | 104 public Str(String internal) { |
160 public int hashCode() { | 159 public int hashCode() { |
161 return internal.hashCode(); | 160 return internal.hashCode(); |
162 } | 161 } |
163 } | 162 } |
164 | 163 |
165 abstract static class BuiltinNode extends ChildrenNode { | 164 @NodeChild(value = "children", type = ValueNode[].class) |
165 abstract static class BuiltinNode extends ValueNode { | |
166 | 166 |
167 protected final Context context; | 167 protected final Context context; |
168 | 168 |
169 public BuiltinNode(BuiltinNode node) { | 169 public BuiltinNode(BuiltinNode node) { |
170 this(node.context, node.children); | 170 this(node.context); |
171 } | 171 } |
172 | 172 |
173 public BuiltinNode(Context context, ValueNode... children) { | 173 public BuiltinNode(Context context) { |
174 super(children); | |
175 this.context = context; | 174 this.context = context; |
176 } | 175 } |
177 | 176 |
178 public Context getContext() { | 177 public Context getContext() { |
179 return context; | 178 return context; |
180 } | 179 } |
181 | |
182 } | 180 } |
183 | 181 |
184 static class Context { | 182 static class Context { |
185 | 183 |
186 } | 184 } |