Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java @ 9779:0e4db5ee0695
Added support for the kind field in @NodeInfo for the source code generation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 21 May 2013 19:20:04 +0200 |
parents | 52fde777a605 |
children |
comparison
equal
deleted
inserted
replaced
9778:7421f2894cfc | 9779:0e4db5ee0695 |
---|---|
24 | 24 |
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 import javax.tools.Diagnostic.*; | 29 import javax.tools.Diagnostic.Kind; |
30 | 30 |
31 import com.oracle.truffle.api.*; | 31 import com.oracle.truffle.api.*; |
32 import com.oracle.truffle.api.frame.*; | 32 import com.oracle.truffle.api.frame.*; |
33 import com.oracle.truffle.api.nodes.*; | 33 import com.oracle.truffle.api.nodes.*; |
34 import com.oracle.truffle.api.nodes.Node.Child; | 34 import com.oracle.truffle.api.nodes.Node.Child; |
45 private final TypeMirror frame; | 45 private final TypeMirror frame; |
46 private final TypeMirror assumption; | 46 private final TypeMirror assumption; |
47 private final TypeMirror invalidAssumption; | 47 private final TypeMirror invalidAssumption; |
48 private final DeclaredType childAnnotation; | 48 private final DeclaredType childAnnotation; |
49 private final DeclaredType childrenAnnotation; | 49 private final DeclaredType childrenAnnotation; |
50 private final DeclaredType nodeInfoAnnotation; | |
51 private final DeclaredType nodeInfoKind; | |
50 private final TypeMirror compilerDirectives; | 52 private final TypeMirror compilerDirectives; |
51 private final TypeMirror compilerAsserts; | 53 private final TypeMirror compilerAsserts; |
52 | 54 |
53 private final List<String> errors = new ArrayList<>(); | 55 private final List<String> errors = new ArrayList<>(); |
54 | 56 |
61 childrenAnnotation = getRequired(context, Children.class); | 63 childrenAnnotation = getRequired(context, Children.class); |
62 compilerDirectives = getRequired(context, CompilerDirectives.class); | 64 compilerDirectives = getRequired(context, CompilerDirectives.class); |
63 compilerAsserts = getRequired(context, CompilerAsserts.class); | 65 compilerAsserts = getRequired(context, CompilerAsserts.class); |
64 assumption = getRequired(context, Assumption.class); | 66 assumption = getRequired(context, Assumption.class); |
65 invalidAssumption = getRequired(context, InvalidAssumptionException.class); | 67 invalidAssumption = getRequired(context, InvalidAssumptionException.class); |
68 nodeInfoAnnotation = getRequired(context, NodeInfo.class); | |
69 nodeInfoKind = getRequired(context, NodeInfo.Kind.class); | |
70 } | |
71 | |
72 public DeclaredType getNodeInfoAnnotation() { | |
73 return nodeInfoAnnotation; | |
66 } | 74 } |
67 | 75 |
68 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { | 76 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { |
69 if (errors.isEmpty()) { | 77 if (errors.isEmpty()) { |
70 return true; | 78 return true; |
73 for (String error : errors) { | 81 for (String error : errors) { |
74 context.getLog().message(Kind.ERROR, element, mirror, null, error); | 82 context.getLog().message(Kind.ERROR, element, mirror, null, error); |
75 } | 83 } |
76 | 84 |
77 return false; | 85 return false; |
86 } | |
87 | |
88 public DeclaredType getNodeInfoKind() { | |
89 return nodeInfoKind; | |
78 } | 90 } |
79 | 91 |
80 private DeclaredType getRequired(ProcessorContext context, Class clazz) { | 92 private DeclaredType getRequired(ProcessorContext context, Class clazz) { |
81 TypeMirror type = context.getType(clazz); | 93 TypeMirror type = context.getType(clazz); |
82 if (type == null) { | 94 if (type == null) { |