comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.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 5e3d1a68664e
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.lang.model.util.*;
30 29
30 import com.oracle.truffle.codegen.processor.*;
31 import com.oracle.truffle.codegen.processor.api.element.*; 31 import com.oracle.truffle.codegen.processor.api.element.*;
32 32
33 public class CodeAnnotationMirror implements WritableAnnotationMirror { 33 public class CodeAnnotationMirror implements WritableAnnotationMirror {
34 34
35 private final DeclaredType annotationType; 35 private final DeclaredType annotationType;
58 public void setElementValue(ExecutableElement method, AnnotationValue value) { 58 public void setElementValue(ExecutableElement method, AnnotationValue value) {
59 values.put(method, value); 59 values.put(method, value);
60 } 60 }
61 61
62 public ExecutableElement findExecutableElement(String name) { 62 public ExecutableElement findExecutableElement(String name) {
63 List<? extends ExecutableElement> elements = ElementFilter.methodsIn(annotationType.asElement().getEnclosedElements()); 63 return Utils.findExecutableElement(annotationType, name);
64 for (ExecutableElement executableElement : elements) {
65 if (executableElement.getSimpleName().toString().equals(name)) {
66 return executableElement;
67 }
68 }
69 return null;
70 } 64 }
71 65
72 public static CodeAnnotationMirror clone(AnnotationMirror mirror) { 66 public static CodeAnnotationMirror clone(AnnotationMirror mirror) {
73 CodeAnnotationMirror copy = new CodeAnnotationMirror(mirror.getAnnotationType()); 67 CodeAnnotationMirror copy = new CodeAnnotationMirror(mirror.getAnnotationType());
74 for (ExecutableElement key : mirror.getElementValues().keySet()) { 68 for (ExecutableElement key : mirror.getElementValues().keySet()) {