Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.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 | 6d92fdf1c999 |
children | 746fa60be266 |
comparison
equal
deleted
inserted
replaced
9778:7421f2894cfc | 9779:0e4db5ee0695 |
---|---|
37 | 37 |
38 /** | 38 /** |
39 * THIS IS NOT PUBLIC API. | 39 * THIS IS NOT PUBLIC API. |
40 */ | 40 */ |
41 public class Utils { | 41 public class Utils { |
42 | |
43 public static ExecutableElement findExecutableElement(DeclaredType type, String name) { | |
44 List<? extends ExecutableElement> elements = ElementFilter.methodsIn(type.asElement().getEnclosedElements()); | |
45 for (ExecutableElement executableElement : elements) { | |
46 if (executableElement.getSimpleName().toString().equals(name)) { | |
47 return executableElement; | |
48 } | |
49 } | |
50 return null; | |
51 } | |
52 | |
53 public static VariableElement findVariableElement(DeclaredType type, String name) { | |
54 List<? extends VariableElement> elements = ElementFilter.fieldsIn(type.asElement().getEnclosedElements()); | |
55 for (VariableElement variableElement : elements) { | |
56 if (variableElement.getSimpleName().toString().equals(name)) { | |
57 return variableElement; | |
58 } | |
59 } | |
60 return null; | |
61 } | |
42 | 62 |
43 public static String getMethodBody(ProcessingEnvironment env, ExecutableElement method) { | 63 public static String getMethodBody(ProcessingEnvironment env, ExecutableElement method) { |
44 if (method instanceof CodeExecutableElement) { | 64 if (method instanceof CodeExecutableElement) { |
45 return ((CodeExecutableElement) method).getBody(); | 65 return ((CodeExecutableElement) method).getBody(); |
46 } else { | 66 } else { |