Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/Parameter.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 | b31b2f289e7d |
children |
comparison
equal
deleted
inserted
replaced
20937:37ea76052733 | 20938:18c0f02fa4d2 |
---|---|
26 import javax.lang.model.type.*; | 26 import javax.lang.model.type.*; |
27 | 27 |
28 public final class Parameter { | 28 public final class Parameter { |
29 | 29 |
30 private final ParameterSpec specification; | 30 private final ParameterSpec specification; |
31 private TypeData typeSystemType; | |
32 private TemplateMethod method; | 31 private TemplateMethod method; |
33 private String localName; | 32 private String localName; |
34 private final int specificationVarArgsIndex; | 33 private final int specificationVarArgsIndex; |
35 private final int typeVarArgsIndex; | 34 private final int typeVarArgsIndex; |
36 | |
37 private final VariableElement variableElement; | 35 private final VariableElement variableElement; |
36 private final TypeMirror type; | |
38 | 37 |
39 public Parameter(ParameterSpec specification, VariableElement variableElement, int specificationVarArgsIndex, int typeVarArgsIndex) { | 38 public Parameter(ParameterSpec specification, VariableElement variableElement, int specificationVarArgsIndex, int typeVarArgsIndex) { |
40 this.specification = specification; | 39 this.specification = specification; |
41 this.variableElement = variableElement; | 40 this.variableElement = variableElement; |
42 this.typeSystemType = null; | 41 this.type = variableElement.asType(); |
43 | |
44 this.specificationVarArgsIndex = specificationVarArgsIndex; | 42 this.specificationVarArgsIndex = specificationVarArgsIndex; |
45 | 43 |
46 String valueName = specification.getName() + "Value"; | 44 String valueName = specification.getName() + "Value"; |
47 if (specificationVarArgsIndex > -1) { | 45 if (specificationVarArgsIndex > -1) { |
48 valueName += specificationVarArgsIndex; | 46 valueName += specificationVarArgsIndex; |
49 } | 47 } |
50 this.typeVarArgsIndex = typeVarArgsIndex; | 48 this.typeVarArgsIndex = typeVarArgsIndex; |
51 this.localName = valueName; | 49 this.localName = valueName; |
52 } | 50 } |
53 | 51 |
54 public Parameter(ParameterSpec specification, TypeData actualType, VariableElement variableElement, int specificationIndex, int varArgsIndex) { | |
55 this(specification, variableElement, specificationIndex, varArgsIndex); | |
56 this.typeSystemType = actualType; | |
57 } | |
58 | |
59 public Parameter(Parameter parameter, TypeData otherType) { | |
60 this(parameter.specification, otherType, parameter.variableElement, parameter.specificationVarArgsIndex, parameter.typeVarArgsIndex); | |
61 } | |
62 | |
63 public Parameter(Parameter parameter) { | 52 public Parameter(Parameter parameter) { |
64 this.specification = parameter.specification; | 53 this.specification = parameter.specification; |
65 this.typeSystemType = parameter.typeSystemType; | |
66 this.specificationVarArgsIndex = parameter.specificationVarArgsIndex; | 54 this.specificationVarArgsIndex = parameter.specificationVarArgsIndex; |
67 this.localName = parameter.localName; | 55 this.localName = parameter.localName; |
68 this.typeVarArgsIndex = parameter.typeVarArgsIndex; | 56 this.typeVarArgsIndex = parameter.typeVarArgsIndex; |
69 this.variableElement = parameter.variableElement; | 57 this.variableElement = parameter.variableElement; |
58 this.type = parameter.type; | |
59 } | |
60 | |
61 public Parameter(Parameter parameter, TypeMirror newType) { | |
62 this.specification = parameter.specification; | |
63 this.specificationVarArgsIndex = parameter.specificationVarArgsIndex; | |
64 this.localName = parameter.localName; | |
65 this.typeVarArgsIndex = parameter.typeVarArgsIndex; | |
66 this.variableElement = parameter.variableElement; | |
67 this.type = newType; | |
70 } | 68 } |
71 | 69 |
72 public void setLocalName(String localName) { | 70 public void setLocalName(String localName) { |
73 this.localName = localName; | 71 this.localName = localName; |
74 } | 72 } |
100 public TemplateMethod getMethod() { | 98 public TemplateMethod getMethod() { |
101 return method; | 99 return method; |
102 } | 100 } |
103 | 101 |
104 public TypeMirror getType() { | 102 public TypeMirror getType() { |
105 return variableElement.asType(); | 103 return type; |
106 } | |
107 | |
108 public TypeData getTypeSystemType() { | |
109 return typeSystemType; | |
110 } | 104 } |
111 | 105 |
112 public boolean isTypeVarArgs() { | 106 public boolean isTypeVarArgs() { |
113 return typeVarArgsIndex >= 0; | 107 return typeVarArgsIndex >= 0; |
114 } | 108 } |