Skip to content

Commit

Permalink
Issue ceylon#564: To support things like MPL methods with defaulted p…
Browse files Browse the repository at this point in the history
…arameters we need to put the branching logic in the MethodDefinitionBuilder itself so it works for things like ClassTransformer.makeOverloadsForDefaultedParameter()
  • Loading branch information
tombentley committed May 29, 2012
1 parent 2c51a21 commit bbe3f27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -878,11 +878,8 @@ ListBuffer<JCTree> transformMethod(Method model,

final MethodDefinitionBuilder methodBuilder = MethodDefinitionBuilder.method(this, Decl.isAncestorLocal(model), model.isClassOrInterfaceMember(),
methodName);
if (Decl.isMpl(model)) {
methodBuilder.resultType(null, makeJavaType(functionalReturnType(model)));
} else {
methodBuilder.resultType(model);
}

methodBuilder.resultType(model);

copyTypeParameters(model, methodBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import static com.sun.tools.javac.code.Flags.STATIC;
import static com.sun.tools.javac.code.TypeTags.VOID;

import com.redhat.ceylon.compiler.java.util.Decl;
import com.redhat.ceylon.compiler.java.util.Util;
import com.redhat.ceylon.compiler.typechecker.model.Annotation;
import com.redhat.ceylon.compiler.typechecker.model.FunctionalParameter;
Expand Down Expand Up @@ -277,9 +278,13 @@ public MethodDefinitionBuilder block(JCBlock block) {
}

public MethodDefinitionBuilder resultType(Method method) {
TypedDeclaration nonWideningTypeDecl = gen.nonWideningTypeDecl(method);
ProducedType nonWideningType = gen.nonWideningType(method, nonWideningTypeDecl);
return resultType(makeResultType(nonWideningTypeDecl, nonWideningType), method);
if (Decl.isMpl(method)) {
return resultType(null, gen.makeJavaType(gen.functionalReturnType(method)));
} else {
TypedDeclaration nonWideningTypeDecl = gen.nonWideningTypeDecl(method);
ProducedType nonWideningType = gen.nonWideningType(method, nonWideningTypeDecl);
return resultType(makeResultType(nonWideningTypeDecl, nonWideningType), method);
}
}

public MethodDefinitionBuilder resultType(TypedDeclaration resultType) {
Expand Down

0 comments on commit bbe3f27

Please sign in to comment.