Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java @ 7794:b891ec348f8a
Made the usage of generic types more flexible for short circuits and generic specializations.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 15 Feb 2013 19:32:58 +0100 |
parents | c17ee8823d72 |
children | 6b74ffe38183 |
comparison
equal
deleted
inserted
replaced
7793:8b48c8ebdff4 | 7794:b891ec348f8a |
---|---|
36 ONE, MULTIPLE; | 36 ONE, MULTIPLE; |
37 } | 37 } |
38 | 38 |
39 private final String name; | 39 private final String name; |
40 private final TypeMirror[] allowedTypes; | 40 private final TypeMirror[] allowedTypes; |
41 private final TypeMirror valueType; | |
42 private final boolean optional; | 41 private final boolean optional; |
43 private final Cardinality cardinality; | 42 private final Cardinality cardinality; |
44 | 43 |
45 public ParameterSpec(String name, TypeMirror[] allowedTypes, TypeMirror valueType, boolean optional, Cardinality cardinality) { | 44 public ParameterSpec(String name, TypeMirror[] allowedTypes, boolean optional, Cardinality cardinality) { |
46 this.valueType = valueType; | |
47 this.allowedTypes = allowedTypes; | 45 this.allowedTypes = allowedTypes; |
48 this.name = name; | 46 this.name = name; |
49 this.optional = optional; | 47 this.optional = optional; |
50 this.cardinality = cardinality; | 48 this.cardinality = cardinality; |
51 } | 49 } |
52 | 50 |
53 /** Type constructor. */ | 51 /** Type constructor. */ |
54 public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional) { | 52 public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional) { |
55 this(name, new TypeMirror[]{singleFixedType}, singleFixedType, optional, Cardinality.ONE); | 53 this(name, new TypeMirror[]{singleFixedType}, optional, Cardinality.ONE); |
56 } | 54 } |
57 | 55 |
58 /** Type system value constructor. */ | 56 /** Type system value constructor. */ |
59 public ParameterSpec(String name, TypeSystemData typeSystem, boolean optional, Cardinality cardinality) { | 57 public ParameterSpec(String name, TypeSystemData typeSystem, boolean optional, Cardinality cardinality) { |
60 this(name, typeSystem.getPrimitiveTypeMirrors(), typeSystem.getGenericType(), optional, cardinality); | 58 this(name, typeSystem.getPrimitiveTypeMirrors(), optional, cardinality); |
61 } | 59 } |
62 | 60 |
63 /** Node value constructor. */ | 61 /** Node value constructor. */ |
64 public ParameterSpec(String name, NodeData nodeData, boolean optional, Cardinality cardinality) { | 62 public ParameterSpec(String name, NodeData nodeData, boolean optional, Cardinality cardinality) { |
65 this(name, nodeTypeMirrors(nodeData), nodeData.getTypeSystem().getGenericType(), optional, cardinality); | 63 this(name, nodeTypeMirrors(nodeData), optional, cardinality); |
66 } | 64 } |
67 | 65 |
68 private static TypeMirror[] nodeTypeMirrors(NodeData nodeData) { | 66 private static TypeMirror[] nodeTypeMirrors(NodeData nodeData) { |
69 Set<TypeMirror> typeMirrors = new LinkedHashSet<>(); | 67 Set<TypeMirror> typeMirrors = new LinkedHashSet<>(); |
70 | 68 |
101 } | 99 } |
102 } | 100 } |
103 return false; | 101 return false; |
104 } | 102 } |
105 | 103 |
106 public TypeMirror getValueType() { | |
107 return valueType; | |
108 } | |
109 } | 104 } |