comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeMethodParser.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 476374f3fe9a
comparison
equal deleted inserted replaced
20937:37ea76052733 20938:18c0f02fa4d2
40 public NodeData getNode() { 40 public NodeData getNode() {
41 return template; 41 return template;
42 } 42 }
43 43
44 protected ParameterSpec createValueParameterSpec(NodeExecutionData execution) { 44 protected ParameterSpec createValueParameterSpec(NodeExecutionData execution) {
45 NodeData childNode = execution.getChild().getNodeData(); 45 ParameterSpec spec = new ParameterSpec(execution.getName(), getPossibleParameterTypes(execution));
46 ParameterSpec spec = new ParameterSpec(execution.getName(), nodeTypeMirrors(childNode), nodeTypeIdentifiers(childNode));
47 spec.setExecution(execution); 46 spec.setExecution(execution);
48 return spec; 47 return spec;
49 } 48 }
50 49
51 protected List<TypeMirror> nodeTypeMirrors(NodeData nodeData) { 50 protected Collection<TypeMirror> getPossibleParameterTypes(NodeExecutionData execution) {
52 return nodeData.getTypeSystem().getPrimitiveTypeMirrors(); 51 return getNode().getPossibleTypes(execution);
53 }
54
55 protected Set<String> nodeTypeIdentifiers(NodeData nodeData) {
56 return nodeData.getTypeSystem().getTypeIdentifiers();
57 } 52 }
58 53
59 protected ParameterSpec createReturnParameterSpec() { 54 protected ParameterSpec createReturnParameterSpec() {
60 ParameterSpec returnValue = new ParameterSpec("returnValue", nodeTypeMirrors(getNode()), nodeTypeIdentifiers(getNode())); 55 ParameterSpec returnValue = new ParameterSpec("returnValue", getPossibleReturnTypes());
61 returnValue.setExecution(getNode().getThisExecution()); 56 returnValue.setExecution(getNode().getThisExecution());
62 return returnValue; 57 return returnValue;
58 }
59
60 protected Collection<TypeMirror> getPossibleReturnTypes() {
61 return getNode().getPossibleTypes(getNode().getThisExecution());
63 } 62 }
64 63
65 @Override 64 @Override
66 public boolean isParsable(ExecutableElement method) { 65 public boolean isParsable(ExecutableElement method) {
67 if (getAnnotationType() != null) { 66 if (getAnnotationType() != null) {