diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeExecutionData.java @ 20938:18c0f02fa4d2

Truffle-DSL: make type systems optional.
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 15:12:48 +0200
parents 906367e494ca
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeExecutionData.java	Tue Apr 14 22:12:03 2015 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeExecutionData.java	Tue Apr 14 15:12:48 2015 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.truffle.dsl.processor.model;
 
+import java.util.*;
+
 import javax.lang.model.type.*;
 
 import com.oracle.truffle.dsl.processor.model.NodeChildData.Cardinality;
@@ -31,17 +33,28 @@
     private final NodeChildData child;
     private final String name;
     private final int index;
+    private final int childIndex;
     private final boolean shortCircuit;
+    private final List<TypeMirror> typeRestrictions = new ArrayList<>();
 
-    public NodeExecutionData(NodeChildData child, int index, boolean shortCircuit) {
+    public NodeExecutionData(NodeChildData child, int index, int childIndex, boolean shortCircuit) {
         this.child = child;
         this.index = index;
+        this.childIndex = childIndex;
         this.shortCircuit = shortCircuit;
         this.name = createName();
     }
 
     private String createName() {
-        return createName(child.getName(), index);
+        return child != null ? createName(child.getName(), childIndex) : ("arg" + index);
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public List<TypeMirror> getTypeRestrictions() {
+        return typeRestrictions;
     }
 
     public TypeMirror getNodeType() {
@@ -62,12 +75,12 @@
         return child;
     }
 
-    public int getIndex() {
-        return index;
+    public int getChildIndex() {
+        return childIndex;
     }
 
     public boolean isIndexed() {
-        return index > -1;
+        return childIndex > -1;
     }
 
     public boolean isShortCircuit() {
@@ -75,7 +88,7 @@
     }
 
     public String getIndexedName() {
-        return createIndexedName(child, index);
+        return createIndexedName(child, childIndex);
     }
 
     public static String createIndexedName(NodeChildData child, int varArgsIndex) {