# HG changeset patch # User Christian Humer # Date 1419892710 -3600 # Node ID 59953a46c56f9352c4701ec7817f843b7c2236d2 # Parent 59bf50cc5a32c2c8a1a7ca5913809b3377267f7a Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory. diff -r 59bf50cc5a32 -r 59953a46c56f graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ArrayTest.java --- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ArrayTest.java Mon Dec 29 23:38:25 2014 +0100 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ArrayTest.java Mon Dec 29 23:38:30 2014 +0100 @@ -26,7 +26,7 @@ import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; -import com.oracle.truffle.api.dsl.test.ArrayTestFactory.TestNode1Factory; +import com.oracle.truffle.api.dsl.test.ArrayTestFactory.TestNode1NodeGen; import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; @@ -34,7 +34,7 @@ @Test public void testNode1() { - final TestNode1 node = TestNode1Factory.create(null); + final TestNode1 node = TestNode1NodeGen.create(null); RootNode root = new RootNode() { @Child TestNode1 test = node; @@ -57,19 +57,19 @@ abstract Object execute(VirtualFrame frame); int executeInt(VirtualFrame frame) throws UnexpectedResultException { - return ArrayTypeSystemGen.ARRAYTYPESYSTEM.expectInteger(execute(frame)); + return ArrayTypeSystemGen.expectInteger(execute(frame)); } int[] executeIntArray(VirtualFrame frame) throws UnexpectedResultException { - return ArrayTypeSystemGen.ARRAYTYPESYSTEM.expectIntArray(execute(frame)); + return ArrayTypeSystemGen.expectIntArray(execute(frame)); } String[] executeStringArray(VirtualFrame frame) throws UnexpectedResultException { - return ArrayTypeSystemGen.ARRAYTYPESYSTEM.expectStringArray(execute(frame)); + return ArrayTypeSystemGen.expectStringArray(execute(frame)); } double[] executeDoubleArray(VirtualFrame frame) throws UnexpectedResultException { - return ArrayTypeSystemGen.ARRAYTYPESYSTEM.expectDoubleArray(execute(frame)); + return ArrayTypeSystemGen.expectDoubleArray(execute(frame)); } } @@ -99,7 +99,7 @@ public static class ArrayTypeSystem { @ImplicitCast - public double[] castFromInt(int[] array) { + public static double[] castFromInt(int[] array) { double[] newArray = new double[array.length]; for (int i = 0; i < array.length; i++) { newArray[i] = array[i]; @@ -108,12 +108,12 @@ } @TypeCheck - public boolean isIntArray(Object array) { + public static boolean isIntArray(Object array) { return array instanceof int[]; } @TypeCast - public int[] asIntArray(Object array) { + public static int[] asIntArray(Object array) { return (int[]) array; } diff -r 59bf50cc5a32 -r 59953a46c56f graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java --- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java Mon Dec 29 23:38:25 2014 +0100 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java Mon Dec 29 23:38:30 2014 +0100 @@ -69,6 +69,7 @@ } @TypeSystemReference(SimpleTypes.class) + @GenerateNodeFactory public static class ValueNode extends Node { public ValueNode() { @@ -134,6 +135,7 @@ } @NodeChild(value = "children", type = ValueNode[].class) + @GenerateNodeFactory public abstract static class ChildrenNode extends ValueNode { }