Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/TemplateMethodParser.java @ 20938:18c0f02fa4d2
Truffle-DSL: make type systems optional.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 15:12:48 +0200 |
parents | 62c43fcf5be2 |
children |
rev | line source |
---|---|
16851
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.dsl.processor.parser; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import java.lang.annotation.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 import java.util.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import javax.lang.model.element.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 import javax.lang.model.type.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import javax.lang.model.util.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.dsl.processor.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.dsl.processor.java.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 import com.oracle.truffle.dsl.processor.model.*; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 public abstract class TemplateMethodParser<T extends Template, E extends TemplateMethod> { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 protected final T template; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 private final ProcessorContext context; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 private final MethodSpecParser parser; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 private boolean parseNullOnError; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 public TemplateMethodParser(ProcessorContext context, T template) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 this.template = template; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 this.context = context; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 this.parser = new MethodSpecParser(template); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 public void setParseNullOnError(boolean parseNullOnError) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 this.parseNullOnError = parseNullOnError; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 public boolean isParseNullOnError() { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 return parseNullOnError; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 public MethodSpecParser getParser() { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 return parser; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 public ProcessorContext getContext() { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 return context; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 public TypeSystemData getTypeSystem() { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 return template.getTypeSystem(); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 public abstract MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
72 public abstract E create(TemplateMethod method, boolean invalid); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 public abstract boolean isParsable(ExecutableElement method); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 public Class<? extends Annotation> getAnnotationType() { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 return null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 public final List<E> parse(List<? extends Element> elements) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 List<ExecutableElement> methods = new ArrayList<>(); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 methods.addAll(ElementFilter.methodsIn(elements)); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 List<E> parsedMethods = new ArrayList<>(); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 boolean valid = true; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 int naturalOrder = 0; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 for (ExecutableElement method : methods) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 if (!isParsable(method)) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 continue; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 Class<? extends Annotation> annotationType = getAnnotationType(); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 AnnotationMirror mirror = null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 if (annotationType != null) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 mirror = ElementUtils.findAnnotationMirror(getContext().getEnvironment(), method, annotationType); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 E parsedMethod = parse(naturalOrder, method, mirror); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 if (method.getModifiers().contains(Modifier.PRIVATE) && parser.isEmitErrors()) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 parsedMethod.addError("Method annotated with @%s must not be private.", getAnnotationType().getSimpleName()); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 parsedMethods.add(parsedMethod); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 valid = false; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 continue; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 if (parsedMethod != null) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 parsedMethods.add(parsedMethod); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 } else { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 valid = false; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 naturalOrder++; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 Collections.sort(parsedMethods); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 if (!valid && isParseNullOnError()) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 return null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 return parsedMethods; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 private E parse(int naturalOrder, ExecutableElement method, AnnotationMirror annotation) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 MethodSpec methodSpecification = createSpecification(method, annotation); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 if (methodSpecification == null) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 return null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 TemplateMethod templateMethod = parser.parse(methodSpecification, method, annotation, naturalOrder); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 if (templateMethod != null) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 return create(templateMethod, templateMethod.hasErrors()); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 return null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 |
19289
62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16851
diff
changeset
|
135 public final E create(String id, int naturalOrder, ExecutableElement methodMetadata, AnnotationMirror mirror, TypeMirror returnType, List<VariableElement> parameterTypes) { |
16851
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 TemplateMethod method = parser.parseImpl(createSpecification(methodMetadata, mirror), naturalOrder, id, methodMetadata, mirror, returnType, parameterTypes); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
137 if (method != null) { |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 return create(method, method.hasErrors()); |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
140 return null; |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
141 } |
2db61eddcb97
Truffle-DSL: argument syntax support for guards
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
142 } |