Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java @ 8593:54e227b2e199
Refactored ParameterSpec constructors.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 01 Apr 2013 12:14:54 +0200 |
parents | a80bf36c6a1e |
children | ce6e8672f798 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java Mon Apr 01 11:52:38 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java Mon Apr 01 12:14:54 2013 +0200 @@ -27,8 +27,6 @@ import javax.lang.model.type.*; import com.oracle.truffle.codegen.processor.*; -import com.oracle.truffle.codegen.processor.node.*; -import com.oracle.truffle.codegen.processor.typesystem.*; public class ParameterSpec { @@ -38,33 +36,33 @@ private final String name; private final List<TypeMirror> allowedTypes; + + /** Cardinality one or multiple. */ private Cardinality cardinality; - private final boolean optional; - private final boolean signature; + /** Type is optional can be dismissed. */ + private boolean optional; + /** Type is part of the method signature. Relevant for comparisons. */ + private boolean signature; + /** Type must be indexed when parsing. */ private boolean indexed; + /** Type is bound to local final variable. */ private boolean local; - public ParameterSpec(String name, List<TypeMirror> allowedTypes, boolean optional, Cardinality cardinality, boolean signature) { - this.allowedTypes = allowedTypes; - this.name = name; - this.optional = optional; - this.cardinality = cardinality; - this.signature = signature; + public ParameterSpec(String name, TypeMirror... allowedTypes) { + this(name, Arrays.asList(allowedTypes)); } - /** Type constructor. */ - public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional, boolean signature) { - this(name, Arrays.asList(singleFixedType), optional, Cardinality.ONE, signature); + public ParameterSpec(String name, List<TypeMirror> allowedTypes) { + this.name = name; + this.allowedTypes = allowedTypes; } - /** Type system value constructor. */ - public ParameterSpec(String name, TypeSystemData typeSystem, boolean optional, Cardinality cardinality, boolean signature) { - this(name, typeSystem.getPrimitiveTypeMirrors(), optional, cardinality, signature); + public void setOptional(boolean optional) { + this.optional = optional; } - /** Node value constructor. */ - public ParameterSpec(String name, NodeData nodeData, boolean optional, Cardinality cardinality, boolean signature) { - this(name, nodeTypeMirrors(nodeData), optional, cardinality, signature); + public void setSignature(boolean signature) { + this.signature = signature; } public void setLocal(boolean local) { @@ -91,18 +89,6 @@ this.cardinality = cardinality; } - private static List<TypeMirror> nodeTypeMirrors(NodeData nodeData) { - Set<TypeMirror> typeMirrors = new LinkedHashSet<>(); - - for (ExecutableTypeData typeData : nodeData.getExecutableTypes()) { - typeMirrors.add(typeData.getType().getPrimitiveType()); - } - - typeMirrors.add(nodeData.getTypeSystem().getGenericType()); - - return new ArrayList<>(typeMirrors); - } - public final String getName() { return name; }