comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/ExecutableTypeMethodParser.java @ 19292:906367e494ca

Truffle-DSL: fix invalid parameter order for executeWith with non-linear execution.
author Christian Humer <christian.humer@gmail.com>
date Wed, 11 Feb 2015 12:13:44 +0100
parents c0fb70634640
children
comparison
equal deleted inserted replaced
19291:f4792a544170 19292:906367e494ca
34 import com.oracle.truffle.dsl.processor.model.*; 34 import com.oracle.truffle.dsl.processor.model.*;
35 35
36 public class ExecutableTypeMethodParser extends NodeMethodParser<ExecutableTypeData> { 36 public class ExecutableTypeMethodParser extends NodeMethodParser<ExecutableTypeData> {
37 37
38 private final List<TypeMirror> frameTypes; 38 private final List<TypeMirror> frameTypes;
39 private final NodeChildData child;
39 40
40 public ExecutableTypeMethodParser(ProcessorContext context, NodeData node, List<TypeMirror> frameTypes) { 41 public ExecutableTypeMethodParser(ProcessorContext context, NodeData node, NodeChildData child, List<TypeMirror> frameTypes) {
41 super(context, node); 42 super(context, node);
43 this.child = child;
42 this.frameTypes = frameTypes; 44 this.frameTypes = frameTypes;
43 setParseNullOnError(false); 45 setParseNullOnError(false);
44 getParser().setEmitErrors(false); 46 getParser().setEmitErrors(false);
45 getParser().setUseVarArgs(true); 47 getParser().setUseVarArgs(true);
46 } 48 }
52 spec.getRequired().clear(); 54 spec.getRequired().clear();
53 55
54 TypeSystemData typeSystem = getNode().getTypeSystem(); 56 TypeSystemData typeSystem = getNode().getTypeSystem();
55 List<TypeMirror> allowedTypes = typeSystem.getPrimitiveTypeMirrors(); 57 List<TypeMirror> allowedTypes = typeSystem.getPrimitiveTypeMirrors();
56 Set<String> allowedIdentifiers = typeSystem.getTypeIdentifiers(); 58 Set<String> allowedIdentifiers = typeSystem.getTypeIdentifiers();
57 for (ParameterSpec originalSpec : requiredSpecs) { 59
58 spec.addRequired(new ParameterSpec(originalSpec, allowedTypes, allowedIdentifiers)); 60 if (child != null) {
61 for (NodeExecutionData executeWith : child.getExecuteWith()) {
62 ParameterSpec parameter = spec.addRequired(new ParameterSpec(executeWith.getName(), allowedTypes, allowedIdentifiers));
63 parameter.setExecution(executeWith);
64 parameter.setSignature(true);
65 }
66 } else {
67 for (ParameterSpec originalSpec : requiredSpecs) {
68 spec.addRequired(new ParameterSpec(originalSpec, allowedTypes, allowedIdentifiers));
69 }
59 } 70 }
71
60 spec.setIgnoreAdditionalSpecifications(true); 72 spec.setIgnoreAdditionalSpecifications(true);
61 spec.setIgnoreAdditionalParameters(true); 73 spec.setIgnoreAdditionalParameters(true);
62 spec.setVariableRequiredParameters(true); 74 spec.setVariableRequiredParameters(true);
63 // varargs 75 // varargs
64 ParameterSpec otherParameters = new ParameterSpec("other", allowedTypes, allowedIdentifiers); 76 ParameterSpec otherParameters = new ParameterSpec("other", allowedTypes, allowedIdentifiers);