Search in sources :

Example 1 with ThrowerMethod

use of org.eclipse.ceylon.compiler.java.codegen.recovery.ThrowerMethod in project ceylon by eclipse.

the class ClassTransformer method transform.

public List<MethodDefinitionBuilder> transform(Tree.AnyMethod def, TransformationPlan plan, ClassDefinitionBuilder classBuilder) {
    Function model = def.getDeclarationModel();
    if (model.isParameter()) {
        return List.nil();
    }
    if (plan instanceof ThrowerMethod) {
        addRefinedThrowerMethod(classBuilder, plan.getErrorMessage().getMessage(), (Class) model.getContainer(), (Function) model.getRefinedDeclaration());
        return List.<MethodDefinitionBuilder>nil();
    }
    // Transform the method body of the 'inner-most method'
    boolean prevSyntheticClassBody = expressionGen().withinSyntheticClassBody(Decl.isMpl(model) || ModelUtil.isLocalNotInitializer(model) || expressionGen().isWithinSyntheticClassBody());
    List<JCStatement> body = transformMethodBody(def);
    expressionGen().withinSyntheticClassBody(prevSyntheticClassBody);
    return transform(def, classBuilder, body);
}
Also used : Function(org.eclipse.ceylon.model.typechecker.model.Function) ThrowerMethod(org.eclipse.ceylon.compiler.java.codegen.recovery.ThrowerMethod) JCStatement(org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCStatement)

Aggregations

ThrowerMethod (org.eclipse.ceylon.compiler.java.codegen.recovery.ThrowerMethod)1 JCStatement (org.eclipse.ceylon.langtools.tools.javac.tree.JCTree.JCStatement)1 Function (org.eclipse.ceylon.model.typechecker.model.Function)1