comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/MethodSpecParser.java @ 20940:476374f3fe9a

Truffle-DSL: generate better polymorphic execute signatures
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 15:12:48 +0200
parents 18c0f02fa4d2
children
comparison
equal deleted inserted replaced
20939:f83fd99b2962 20940:476374f3fe9a
79 public TemplateMethod parseImpl(MethodSpec methodSpecification, int naturalOrder, String id, ExecutableElement method, AnnotationMirror annotation, TypeMirror returnType, 79 public TemplateMethod parseImpl(MethodSpec methodSpecification, int naturalOrder, String id, ExecutableElement method, AnnotationMirror annotation, TypeMirror returnType,
80 List<? extends VariableElement> parameterTypes) { 80 List<? extends VariableElement> parameterTypes) {
81 ParameterSpec returnTypeSpec = methodSpecification.getReturnType(); 81 ParameterSpec returnTypeSpec = methodSpecification.getReturnType();
82 Parameter returnTypeMirror = matchParameter(returnTypeSpec, new CodeVariableElement(returnType, "returnType"), -1, -1); 82 Parameter returnTypeMirror = matchParameter(returnTypeSpec, new CodeVariableElement(returnType, "returnType"), -1, -1);
83 if (returnTypeMirror == null) { 83 if (returnTypeMirror == null) {
84 if (emitErrors) { 84 if (isEmitErrors() && method != null) {
85 TemplateMethod invalidMethod = new TemplateMethod(id, naturalOrder, template, methodSpecification, method, annotation, returnTypeMirror, Collections.<Parameter> emptyList()); 85 TemplateMethod invalidMethod = new TemplateMethod(id, naturalOrder, template, methodSpecification, method, annotation, returnTypeMirror, Collections.<Parameter> emptyList());
86 String expectedReturnType = returnTypeSpec.toSignatureString(true); 86 String expectedReturnType = returnTypeSpec.toSignatureString(true);
87 String actualReturnType = ElementUtils.getSimpleName(returnType); 87 String actualReturnType = ElementUtils.getSimpleName(returnType);
88 88
89 String message = String.format("The provided return type \"%s\" does not match expected return type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType, 89 String message = String.format("The provided return type \"%s\" does not match expected return type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,