comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java @ 11545:2fb276f5e3e9

Truffle-DSL: implemented implicit casts.
author Christian Humer <christian.humer@gmail.com>
date Fri, 06 Sep 2013 16:16:40 +0200
parents 578fc20b9380
children 85b846b31690
comparison
equal deleted inserted replaced
11544:e5b5a5cb0ac7 11545:2fb276f5e3e9
330 nodeData.setNodeType(nodeType); 330 nodeData.setNodeType(nodeType);
331 AnnotationMirror nodeContainer = findFirstAnnotation(typeHierarchy, NodeContainer.class); 331 AnnotationMirror nodeContainer = findFirstAnnotation(typeHierarchy, NodeContainer.class);
332 nodeData.setNodeContainer(nodeContainer != null); 332 nodeData.setNodeContainer(nodeContainer != null);
333 nodeData.setTypeSystem(typeSystem); 333 nodeData.setTypeSystem(typeSystem);
334 nodeData.setFields(parseFields(typeHierarchy, elements)); 334 nodeData.setFields(parseFields(typeHierarchy, elements));
335 nodeData.setChildren(parseChildren(elements, typeHierarchy)); 335 nodeData.setChildren(parseChildren(nodeData, elements, typeHierarchy));
336 nodeData.setExecutableTypes(groupExecutableTypes(new ExecutableTypeMethodParser(context, nodeData).parse(elements))); 336 nodeData.setExecutableTypes(groupExecutableTypes(new ExecutableTypeMethodParser(context, nodeData).parse(elements)));
337 337
338 // resolveChildren invokes cyclic parsing. 338 // resolveChildren invokes cyclic parsing.
339 parsedNodes.put(Utils.getQualifiedName(templateType), nodeData); 339 parsedNodes.put(Utils.getQualifiedName(templateType), nodeData);
340 resolveChildren(nodeData); 340 resolveChildren(nodeData);
405 } 405 }
406 } 406 }
407 } 407 }
408 } 408 }
409 409
410 private List<NodeChildData> parseChildren(List<? extends Element> elements, final List<TypeElement> typeHierarchy) { 410 private List<NodeChildData> parseChildren(NodeData parent, List<? extends Element> elements, final List<TypeElement> typeHierarchy) {
411 Set<String> shortCircuits = new HashSet<>(); 411 Set<String> shortCircuits = new HashSet<>();
412 for (ExecutableElement method : ElementFilter.methodsIn(elements)) { 412 for (ExecutableElement method : ElementFilter.methodsIn(elements)) {
413 AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, method, ShortCircuit.class); 413 AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, method, ShortCircuit.class);
414 if (mirror != null) { 414 if (mirror != null) {
415 shortCircuits.add(Utils.getAnnotationValue(String.class, mirror, "value")); 415 shortCircuits.add(Utils.getAnnotationValue(String.class, mirror, "value"));
470 ExecutionKind kind = ExecutionKind.DEFAULT; 470 ExecutionKind kind = ExecutionKind.DEFAULT;
471 if (shortCircuits.contains(name)) { 471 if (shortCircuits.contains(name)) {
472 kind = ExecutionKind.SHORT_CIRCUIT; 472 kind = ExecutionKind.SHORT_CIRCUIT;
473 } 473 }
474 474
475 NodeChildData nodeChild = new NodeChildData(type, childMirror, name, childType, originalChildType, getter, cardinality, kind); 475 NodeChildData nodeChild = new NodeChildData(parent, type, childMirror, name, childType, originalChildType, getter, cardinality, kind);
476 476
477 parsedChildren.add(nodeChild); 477 parsedChildren.add(nodeChild);
478 478
479 verifyNodeChild(nodeChild); 479 verifyNodeChild(nodeChild);
480 if (nodeChild.hasErrors()) { 480 if (nodeChild.hasErrors()) {