Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/TypeSystemData.java @ 18761:a665483c3881
Truffle-DSL: new node layout implementation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 29 Dec 2014 23:38:54 +0100 |
parents | 58eb9bbb60c4 |
children | ae81dd154fb6 |
comparison
equal
deleted
inserted
replaced
18760:6fa3999631d8 | 18761:a665483c3881 |
---|---|
25 import java.util.*; | 25 import java.util.*; |
26 | 26 |
27 import javax.lang.model.element.*; | 27 import javax.lang.model.element.*; |
28 import javax.lang.model.type.*; | 28 import javax.lang.model.type.*; |
29 | 29 |
30 import com.oracle.truffle.api.dsl.internal.*; | |
30 import com.oracle.truffle.dsl.processor.*; | 31 import com.oracle.truffle.dsl.processor.*; |
31 import com.oracle.truffle.dsl.processor.java.*; | 32 import com.oracle.truffle.dsl.processor.java.*; |
32 | 33 |
33 public class TypeSystemData extends Template { | 34 public class TypeSystemData extends Template { |
34 | 35 |
40 private List<ImplicitCastData> implicitCasts; | 41 private List<ImplicitCastData> implicitCasts; |
41 private List<TypeCastData> casts; | 42 private List<TypeCastData> casts; |
42 private List<TypeCheckData> checks; | 43 private List<TypeCheckData> checks; |
43 | 44 |
44 private TypeMirror genericType; | 45 private TypeMirror genericType; |
46 private TypeData booleanType; | |
45 private TypeData voidType; | 47 private TypeData voidType; |
46 | 48 |
47 public TypeSystemData(ProcessorContext context, TypeElement templateType, AnnotationMirror annotation) { | 49 private DSLOptions options; |
48 super(context, templateType, null, annotation); | 50 |
51 public TypeSystemData(ProcessorContext context, TypeElement templateType, AnnotationMirror annotation, DSLOptions options) { | |
52 super(context, templateType, annotation); | |
53 this.options = options; | |
54 } | |
55 | |
56 public DSLOptions getOptions() { | |
57 return options; | |
49 } | 58 } |
50 | 59 |
51 @Override | 60 @Override |
52 public TypeSystemData getTypeSystem() { | 61 public TypeSystemData getTypeSystem() { |
53 return this; | 62 return this; |
194 } | 203 } |
195 } | 204 } |
196 return null; | 205 return null; |
197 } | 206 } |
198 | 207 |
208 public boolean hasImplicitSourceTypes(TypeData targetType) { | |
209 if (getImplicitCasts() == null) { | |
210 return false; | |
211 } | |
212 for (ImplicitCastData cast : getImplicitCasts()) { | |
213 if (cast.getTargetType() == targetType) { | |
214 return true; | |
215 } | |
216 } | |
217 return false; | |
218 } | |
219 | |
199 public List<TypeData> lookupSourceTypes(TypeData type) { | 220 public List<TypeData> lookupSourceTypes(TypeData type) { |
200 List<TypeData> sourceTypes = new ArrayList<>(); | 221 List<TypeData> sourceTypes = new ArrayList<>(); |
201 sourceTypes.add(type); | 222 sourceTypes.add(type); |
202 if (getImplicitCasts() != null) { | 223 if (getImplicitCasts() != null) { |
203 for (ImplicitCastData cast : getImplicitCasts()) { | 224 for (ImplicitCastData cast : getImplicitCasts()) { |
208 } | 229 } |
209 Collections.sort(sourceTypes); | 230 Collections.sort(sourceTypes); |
210 return sourceTypes; | 231 return sourceTypes; |
211 } | 232 } |
212 | 233 |
234 public TypeData getBooleanType() { | |
235 return booleanType; | |
236 } | |
237 | |
238 public void setBooleanType(TypeData booleanType) { | |
239 this.booleanType = booleanType; | |
240 } | |
241 | |
213 } | 242 } |