comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java @ 8252:0905d796944a

Refactored codegen error model to make error redirection a lot easier.
author Christian Humer <christian.humer@gmail.com>
date Wed, 13 Mar 2013 19:58:28 +0100
parents c4c3f50fa9c2
children 61ba6fc21ba4
comparison
equal deleted inserted replaced
8251:cb70ed101b5f 8252:0905d796944a
28 import javax.lang.model.type.*; 28 import javax.lang.model.type.*;
29 29
30 import com.oracle.truffle.codegen.processor.*; 30 import com.oracle.truffle.codegen.processor.*;
31 import com.oracle.truffle.codegen.processor.template.*; 31 import com.oracle.truffle.codegen.processor.template.*;
32 32
33 public class TypeData extends Template { 33 public class TypeData extends MessageContainer {
34 34
35 protected TypeSystemData typeSystem; 35 private final TypeSystemData typeSystem;
36 private final AnnotationValue annotationValue;
36 private final TypeMirror primitiveType; 37 private final TypeMirror primitiveType;
37 private final TypeMirror boxedType; 38 private final TypeMirror boxedType;
38 39
39 private final List<TypeCastData> typeCasts = new ArrayList<>(); 40 private final List<TypeCastData> typeCasts = new ArrayList<>();
40 private final List<TypeCheckData> typeChecks = new ArrayList<>(); 41 private final List<TypeCheckData> typeChecks = new ArrayList<>();
41 42
42 public TypeData(TypeElement templateType, AnnotationMirror annotation, TypeMirror primitiveType, TypeMirror boxedType) { 43 public TypeData(TypeSystemData typeSystem, AnnotationValue value, TypeMirror primitiveType, TypeMirror boxedType) {
43 super(templateType, null, annotation); 44 this.typeSystem = typeSystem;
45 this.annotationValue = value;
44 this.primitiveType = primitiveType; 46 this.primitiveType = primitiveType;
45 this.boxedType = boxedType; 47 this.boxedType = boxedType;
48 }
49
50 @Override
51 public Element getMessageElement() {
52 return typeSystem.getMessageElement();
53 }
54
55 @Override
56 public AnnotationMirror getMessageAnnotation() {
57 return typeSystem.getMessageAnnotation();
58 }
59
60 @Override
61 public AnnotationValue getMessageAnnotationValue() {
62 return annotationValue;
46 } 63 }
47 64
48 void addTypeCast(TypeCastData typeCast) { 65 void addTypeCast(TypeCastData typeCast) {
49 this.typeCasts.add(typeCast); 66 this.typeCasts.add(typeCast);
50 } 67 }