changeset 18755:59953a46c56f

Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
author Christian Humer <christian.humer@gmail.com>
date Mon, 29 Dec 2014 23:38:30 +0100
parents 59bf50cc5a32
children c22714b214d0
files graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ArrayTest.java graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
 
--- 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 {
 
     }