Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java @ 9279:2a4b57f02fb4
Implemented basic support for assumptions for sourcecode generation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 24 Apr 2013 17:44:15 +0200 |
parents | fe5bc02fcd19 |
children | 52fde777a605 |
comparison
equal
deleted
inserted
replaced
9276:a9cfbe03d9c4 | 9279:2a4b57f02fb4 |
---|---|
41 | 41 |
42 private final TypeMirror node; | 42 private final TypeMirror node; |
43 private final TypeMirror nodeArray; | 43 private final TypeMirror nodeArray; |
44 private final TypeMirror unexpectedValueException; | 44 private final TypeMirror unexpectedValueException; |
45 private final TypeMirror frame; | 45 private final TypeMirror frame; |
46 private final TypeMirror assumption; | |
47 private final TypeMirror invalidAssumption; | |
46 private final DeclaredType childAnnotation; | 48 private final DeclaredType childAnnotation; |
47 private final DeclaredType childrenAnnotation; | 49 private final DeclaredType childrenAnnotation; |
48 private final TypeMirror compilerDirectives; | 50 private final TypeMirror compilerDirectives; |
49 | 51 |
50 private final List<String> errors = new ArrayList<>(); | 52 private final List<String> errors = new ArrayList<>(); |
55 unexpectedValueException = getRequired(context, UnexpectedResultException.class); | 57 unexpectedValueException = getRequired(context, UnexpectedResultException.class); |
56 frame = getRequired(context, VirtualFrame.class); | 58 frame = getRequired(context, VirtualFrame.class); |
57 childAnnotation = getRequired(context, Child.class); | 59 childAnnotation = getRequired(context, Child.class); |
58 childrenAnnotation = getRequired(context, Children.class); | 60 childrenAnnotation = getRequired(context, Children.class); |
59 compilerDirectives = getRequired(context, CompilerDirectives.class); | 61 compilerDirectives = getRequired(context, CompilerDirectives.class); |
62 assumption = getRequired(context, Assumption.class); | |
63 invalidAssumption = getRequired(context, InvalidAssumptionException.class); | |
60 } | 64 } |
61 | 65 |
62 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { | 66 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { |
63 if (errors.isEmpty()) { | 67 if (errors.isEmpty()) { |
64 return true; | 68 return true; |
75 TypeMirror type = context.getType(clazz); | 79 TypeMirror type = context.getType(clazz); |
76 if (type == null) { | 80 if (type == null) { |
77 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName())); | 81 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName())); |
78 } | 82 } |
79 return (DeclaredType) type; | 83 return (DeclaredType) type; |
84 } | |
85 | |
86 public TypeMirror getInvalidAssumption() { | |
87 return invalidAssumption; | |
88 } | |
89 | |
90 public TypeMirror getAssumption() { | |
91 return assumption; | |
80 } | 92 } |
81 | 93 |
82 public TypeMirror getCompilerDirectives() { | 94 public TypeMirror getCompilerDirectives() { |
83 return compilerDirectives; | 95 return compilerDirectives; |
84 } | 96 } |