Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/MethodSpec.java @ 13527:25ecb47a6d0e
Truffle-DSL: Added support for references to child arrays in @ShortCircuit;
Introduced new layer NodeExecutionData to the implementation model which is in between NodeChildData and the actual parameters..
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 07 Jan 2014 12:22:47 +0100 |
parents | 2b9fcffd6f36 |
children | e8ef44830b50 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/MethodSpec.java Thu Dec 26 12:37:28 2013 -0800 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/MethodSpec.java Tue Jan 07 12:22:47 2014 +0100 @@ -27,7 +27,6 @@ import javax.lang.model.type.*; import com.oracle.truffle.dsl.processor.*; -import com.oracle.truffle.dsl.processor.node.NodeChildData.*; public class MethodSpec { @@ -37,34 +36,36 @@ private final List<ParameterSpec> optional = new ArrayList<>(); private final List<ParameterSpec> required = new ArrayList<>(); - private int minimumRequiredArguments; - private boolean variableRequiredArguments; + private boolean ignoreAdditionalParameters; + private boolean ignoreAdditionalSpecifications; + private boolean variableRequiredParameters; + private List<TypeDef> typeDefinitions; public MethodSpec(ParameterSpec returnType) { this.returnType = returnType; } - public void setMinimumRequiredArguments(int minimumRequiredArguments) { - this.minimumRequiredArguments = minimumRequiredArguments; + public void setVariableRequiredParameters(boolean variableRequiredParameters) { + this.variableRequiredParameters = variableRequiredParameters; } - public int getMinimumRequiredArguments() { - return minimumRequiredArguments; - } - - public void setVariableRequiredArguments(boolean variableArguments) { - this.variableRequiredArguments = variableArguments; - } - - public boolean isVariableRequiredArguments() { - return variableRequiredArguments; + public boolean isVariableRequiredParameters() { + return variableRequiredParameters; } public void addImplicitRequiredType(TypeMirror type) { this.implicitRequiredTypes.add(type); } + public void setIgnoreAdditionalParameters(boolean ignoreAdditionalParameter) { + this.ignoreAdditionalParameters = ignoreAdditionalParameter; + } + + public boolean isIgnoreAdditionalParameters() { + return ignoreAdditionalParameters; + } + public void addOptional(ParameterSpec spec) { optional.add(spec); } @@ -158,15 +159,18 @@ sep = ", "; } - for (ParameterSpec requiredSpec : getRequired()) { + for (int i = 0; i < getRequired().size(); i++) { + ParameterSpec requiredSpec = getRequired().get(i); b.append(sep); - if (requiredSpec.getCardinality() == Cardinality.MANY) { - b.append("{"); + + if (isVariableRequiredParameters() && i == getRequired().size() - 1) { + b.append(("{")); } b.append(createTypeSignature(requiredSpec, false)); - if (requiredSpec.getCardinality() == Cardinality.MANY) { - b.append("}"); + if (isVariableRequiredParameters() && i == getRequired().size() - 1) { + b.append(("}")); } + sep = ", "; } @@ -234,4 +238,12 @@ } } + public void setIgnoreAdditionalSpecifications(boolean ignoreAdditoinalSpecifications) { + this.ignoreAdditionalSpecifications = ignoreAdditoinalSpecifications; + } + + public boolean isIgnoreAdditionalSpecifications() { + return ignoreAdditionalSpecifications; + } + }