Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java @ 10444:ad48251630cd
Fixed GRAAL-321.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 18 Jun 2013 10:11:28 +0200 |
parents | 0e4db5ee0695 |
children | 746fa60be266 |
comparison
equal
deleted
inserted
replaced
10443:8b2573c8d47f | 10444:ad48251630cd |
---|---|
40 import com.oracle.truffle.codegen.processor.typesystem.*; | 40 import com.oracle.truffle.codegen.processor.typesystem.*; |
41 | 41 |
42 public class NodeParser extends TemplateParser<NodeData> { | 42 public class NodeParser extends TemplateParser<NodeData> { |
43 | 43 |
44 public static final List<Class<? extends Annotation>> ANNOTATIONS = Arrays.asList(Generic.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class, SpecializationListener.class, | 44 public static final List<Class<? extends Annotation>> ANNOTATIONS = Arrays.asList(Generic.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class, SpecializationListener.class, |
45 ExecuteChildren.class, NodeClass.class, NodeChild.class, NodeChildren.class, NodeId.class); | 45 NodeClass.class, NodeChild.class, NodeChildren.class, NodeId.class); |
46 | 46 |
47 private Map<String, NodeData> parsedNodes; | 47 private Map<String, NodeData> parsedNodes; |
48 | 48 |
49 public NodeParser(ProcessorContext c) { | 49 public NodeParser(ProcessorContext c) { |
50 super(c); | 50 super(c); |
752 if (nodeClassMirror != null) { | 752 if (nodeClassMirror != null) { |
753 nodeClassType = inheritType(nodeClassMirror, "value", nodeClassType); | 753 nodeClassType = inheritType(nodeClassMirror, "value", nodeClassType); |
754 } | 754 } |
755 | 755 |
756 List<AnnotationMirror> children = Utils.collectAnnotations(context, nodeChildrenMirror, "value", type, NodeChild.class); | 756 List<AnnotationMirror> children = Utils.collectAnnotations(context, nodeChildrenMirror, "value", type, NodeChild.class); |
757 int index = 0; | |
757 for (AnnotationMirror childMirror : children) { | 758 for (AnnotationMirror childMirror : children) { |
758 String name = Utils.getAnnotationValue(String.class, childMirror, "value"); | 759 String name = Utils.getAnnotationValue(String.class, childMirror, "value"); |
760 if (name.equals("")) { | |
761 name = "child" + index; | |
762 } | |
759 | 763 |
760 Cardinality cardinality = Cardinality.ONE; | 764 Cardinality cardinality = Cardinality.ONE; |
761 | 765 |
762 TypeMirror childType = inheritType(childMirror, "type", nodeClassType); | 766 TypeMirror childType = inheritType(childMirror, "type", nodeClassType); |
763 if (childType.getKind() == TypeKind.ARRAY) { | 767 if (childType.getKind() == TypeKind.ARRAY) { |
783 NodeData fieldNodeData = resolveNode(Utils.fromTypeMirror(childType)); | 787 NodeData fieldNodeData = resolveNode(Utils.fromTypeMirror(childType)); |
784 nodeChild.setNode(fieldNodeData); | 788 nodeChild.setNode(fieldNodeData); |
785 if (fieldNodeData == null) { | 789 if (fieldNodeData == null) { |
786 nodeChild.addError("Node type '%s' is invalid or not a valid Node.", Utils.getQualifiedName(childType)); | 790 nodeChild.addError("Node type '%s' is invalid or not a valid Node.", Utils.getQualifiedName(childType)); |
787 } | 791 } |
788 } | 792 |
793 } | |
794 index++; | |
789 } | 795 } |
790 | 796 |
791 List<NodeChildData> filteredChildren = new ArrayList<>(); | 797 List<NodeChildData> filteredChildren = new ArrayList<>(); |
792 Set<String> encounteredNames = new HashSet<>(); | 798 Set<String> encounteredNames = new HashSet<>(); |
793 for (int i = parsedChildren.size() - 1; i >= 0; i--) { | 799 for (int i = parsedChildren.size() - 1; i >= 0; i--) { |