Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java @ 8240:33e08aca06ff
Codegen API change. Simplified definition of guards.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 01 Mar 2013 18:04:23 +0100 |
parents | 39d4a79568b6 |
children | 703c09f8640c |
comparison
equal
deleted
inserted
replaced
8239:8fa2eed07f81 | 8240:33e08aca06ff |
---|---|
25 import java.lang.annotation.*; | 25 import java.lang.annotation.*; |
26 import java.util.*; | 26 import java.util.*; |
27 | 27 |
28 import javax.lang.model.element.*; | 28 import javax.lang.model.element.*; |
29 | 29 |
30 import com.oracle.truffle.api.codegen.*; | |
31 import com.oracle.truffle.codegen.processor.*; | 30 import com.oracle.truffle.codegen.processor.*; |
32 import com.oracle.truffle.codegen.processor.template.*; | 31 import com.oracle.truffle.codegen.processor.template.*; |
33 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; | 32 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; |
34 | 33 |
35 public class GuardParser extends TemplateMethodParser<Template, GuardData> { | 34 public class GuardParser extends TemplateMethodParser<Template, GuardData> { |
37 private final TypeSystemData typeSystem; | 36 private final TypeSystemData typeSystem; |
38 | 37 |
39 public GuardParser(ProcessorContext context, Template template, TypeSystemData typeSystem) { | 38 public GuardParser(ProcessorContext context, Template template, TypeSystemData typeSystem) { |
40 super(context, template); | 39 super(context, template); |
41 this.typeSystem = typeSystem; | 40 this.typeSystem = typeSystem; |
41 setEmitErrors(false); | |
42 setParseNullOnError(false); | |
42 } | 43 } |
43 | 44 |
44 @Override | 45 @Override |
45 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) { | 46 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) { |
46 List<ParameterSpec> specs = new ArrayList<>(); | 47 List<ParameterSpec> specs = new ArrayList<>(); |
49 return new MethodSpec(returnTypeSpec, specs); | 50 return new MethodSpec(returnTypeSpec, specs); |
50 } | 51 } |
51 | 52 |
52 @Override | 53 @Override |
53 public boolean isParsable(ExecutableElement method) { | 54 public boolean isParsable(ExecutableElement method) { |
54 return Utils.findAnnotationMirror(getContext().getEnvironment(), method, getAnnotationType()) != null; | 55 return true; |
55 } | 56 } |
56 | 57 |
57 @Override | 58 @Override |
58 public GuardData create(TemplateMethod method) { | 59 public GuardData create(TemplateMethod method) { |
59 return new GuardData(method, template); | 60 return new GuardData(method, template); |
60 } | 61 } |
61 | 62 |
62 @Override | 63 @Override |
63 public Class<? extends Annotation> getAnnotationType() { | 64 public Class<? extends Annotation> getAnnotationType() { |
64 return GuardCheck.class; | 65 return null; |
65 } | 66 } |
66 | 67 |
67 } | 68 } |