Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/TemplateMethodParser.java @ 13535:e8ef44830b50
Truffle-DSL: fixed bugs due to previous cleanup. addtional cleanup.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 07 Jan 2014 22:06:37 +0100 |
parents | 85b485b1e8e1 |
children | bd28da642eea |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/TemplateMethodParser.java Tue Jan 07 20:21:17 2014 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/TemplateMethodParser.java Tue Jan 07 22:06:37 2014 +0100 @@ -169,9 +169,9 @@ List<ActualParameter> parameters = parseParameters(methodSpecification, parameterTypes, isUseVarArgs() && method != null ? method.isVarArgs() : false); if (parameters == null) { - if (isEmitErrors()) { + if (isEmitErrors() && method != null) { E invalidMethod = create(new TemplateMethod(id, template, methodSpecification, method, annotation, returnTypeMirror, Collections.<ActualParameter> emptyList()), true); - String message = String.format("Method signature %s does not match to the expected signature: \n%s", createActualSignature(methodSpecification, method), + String message = String.format("Method signature %s does not match to the expected signature: \n%s", createActualSignature(method), methodSpecification.toSignatureString(method.getSimpleName().toString())); invalidMethod.addError(message); return invalidMethod; @@ -183,18 +183,15 @@ return create(new TemplateMethod(id, template, methodSpecification, method, annotation, returnTypeMirror, parameters), false); } - private static String createActualSignature(MethodSpec spec, ExecutableElement method) { + private static String createActualSignature(ExecutableElement method) { StringBuilder b = new StringBuilder("("); String sep = ""; - for (TypeMirror implicitType : spec.getImplicitRequiredTypes()) { - b.append(sep); - b.append("implicit " + Utils.getSimpleName(implicitType)); - sep = ", "; - } - for (VariableElement var : method.getParameters()) { - b.append(sep); - b.append(Utils.getSimpleName(var.asType())); - sep = ", "; + if (method != null) { + for (VariableElement var : method.getParameters()) { + b.append(sep); + b.append(Utils.getSimpleName(var.asType())); + sep = ", "; + } } b.append(")"); return b.toString(); @@ -207,12 +204,10 @@ * ones are cut and used to parse the optional parameters. */ private List<ActualParameter> parseParameters(MethodSpec spec, List<TypeMirror> parameterTypes, boolean varArgs) { - List<TypeMirror> implicitTypes = spec.getImplicitRequiredTypes(); - List<ActualParameter> parsedRequired = null; int offset = 0; for (; offset <= parameterTypes.size(); offset++) { - List<TypeMirror> parameters = new ArrayList<>(implicitTypes); + List<TypeMirror> parameters = new ArrayList<>(); parameters.addAll(parameterTypes.subList(offset, parameterTypes.size())); parsedRequired = parseParametersRequired(spec, parameters, varArgs); if (parsedRequired != null) {