Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java @ 8242:ac4e8c16ffdf
Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 04 Mar 2013 15:14:11 +0100 |
parents | 6b74ffe38183 |
children | 703c09f8640c |
comparison
equal
deleted
inserted
replaced
8241:91982900acee | 8242:ac4e8c16ffdf |
---|---|
29 | 29 |
30 import javax.lang.model.element.*; | 30 import javax.lang.model.element.*; |
31 import javax.lang.model.type.*; | 31 import javax.lang.model.type.*; |
32 import javax.lang.model.util.*; | 32 import javax.lang.model.util.*; |
33 | 33 |
34 import com.oracle.truffle.api.codegen.*; | |
34 import com.oracle.truffle.codegen.processor.*; | 35 import com.oracle.truffle.codegen.processor.*; |
35 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; | 36 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; |
36 | 37 |
37 public abstract class TemplateMethodParser<T extends Template, E extends TemplateMethod> { | 38 public abstract class TemplateMethodParser<T extends Template, E extends TemplateMethod> { |
38 | 39 |
147 createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs)); | 148 createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs)); |
148 context.getLog().error(method, annotation, message); | 149 context.getLog().error(method, annotation, message); |
149 } | 150 } |
150 return null; | 151 return null; |
151 } | 152 } |
153 | |
154 String id = method.getSimpleName().toString(); | |
155 AnnotationMirror idAnnotation = Utils.findAnnotationMirror(context.getEnvironment(), method, NodeId.class); | |
156 if (idAnnotation != null) { | |
157 id = Utils.getAnnotationValueString(idAnnotation, "value"); | |
158 } | |
159 | |
152 ActualParameter[] paramMirrors = parameters.toArray(new ActualParameter[parameters.size()]); | 160 ActualParameter[] paramMirrors = parameters.toArray(new ActualParameter[parameters.size()]); |
153 return create(new TemplateMethod(template, methodSpecification, method, annotation, returnTypeMirror, paramMirrors)); | 161 return create(new TemplateMethod(id, template, methodSpecification, method, annotation, returnTypeMirror, paramMirrors)); |
154 } | 162 } |
155 | 163 |
156 private List<ActualParameter> parseParameters(ExecutableElement method, List<ParameterSpec> parameterSpecs) { | 164 private List<ActualParameter> parseParameters(ExecutableElement method, List<ParameterSpec> parameterSpecs) { |
157 Iterator<? extends VariableElement> parameterIterator = method.getParameters().iterator(); | 165 Iterator<? extends VariableElement> parameterIterator = method.getParameters().iterator(); |
158 Iterator<? extends ParameterSpec> specificationIterator = parameterSpecs.iterator(); | 166 Iterator<? extends ParameterSpec> specificationIterator = parameterSpecs.iterator(); |