Search in sources :

Example 11 with TransformationPlan

use of com.redhat.ceylon.compiler.java.codegen.recovery.TransformationPlan in project ceylon-compiler by ceylon.

the class CeylonVisitor method visit.

public void visit(final Tree.AttributeSetterDefinition decl) {
    TransformationPlan plan = gen.errors().hasDeclarationAndMarkBrokenness(decl);
    if (plan instanceof Drop) {
        return;
    }
    TransformationPlan getterPlan = gen.errors().hasDeclarationAndMarkBrokenness(getterSetterPairing.getGetter(decl));
    if (getterPlan instanceof Drop) {
        // because there's little chance we'll be able to generate a correct setter
        return;
    }
    if (!acceptDeclaration(decl))
        return;
    int annots = gen.checkCompilerAnnotations(decl, defs);
    if (Decl.withinClass(decl) && !Decl.isLocalToInitializer(decl)) {
        classBuilder.attribute(gen.classGen().transform(decl, false));
    } else if (Decl.withinInterface(decl)) {
        classBuilder.attribute(gen.classGen().transform(decl, false));
        AttributeDefinitionBuilder adb = gen.classGen().transform(decl, true);
        if (decl.getDeclarationModel().isShared()) {
            adb.ignoreAnnotations();
        }
        classBuilder.getCompanionBuilder((Interface) decl.getDeclarationModel().getContainer()).attribute(adb);
    } else if (Decl.isToplevel(decl)) {
        topattrBuilder.add(decl);
    } else {
        appendList(gen.transform(decl));
    }
    gen.resetCompilerAnnotations(annots);
}
Also used : TransformationPlan(com.redhat.ceylon.compiler.java.codegen.recovery.TransformationPlan) Drop(com.redhat.ceylon.compiler.java.codegen.recovery.Drop)

Aggregations

TransformationPlan (com.redhat.ceylon.compiler.java.codegen.recovery.TransformationPlan)11 Drop (com.redhat.ceylon.compiler.java.codegen.recovery.Drop)9 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)4 ClassOrInterface (com.redhat.ceylon.model.typechecker.model.ClassOrInterface)4 Interface (com.redhat.ceylon.model.typechecker.model.Interface)4 JCTree (com.sun.tools.javac.tree.JCTree)4 JCPrimitiveTypeTree (com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree)3 ThrowerCatchallConstructor (com.redhat.ceylon.compiler.java.codegen.recovery.ThrowerCatchallConstructor)2 LazyInterface (com.redhat.ceylon.model.loader.model.LazyInterface)2 Class (com.redhat.ceylon.model.typechecker.model.Class)2 JCExpression (com.sun.tools.javac.tree.JCTree.JCExpression)2 JCStatement (com.sun.tools.javac.tree.JCTree.JCStatement)2 SyntheticName (com.redhat.ceylon.compiler.java.codegen.Naming.SyntheticName)1 CustomTree (com.redhat.ceylon.compiler.typechecker.tree.CustomTree)1 AttributeDeclaration (com.redhat.ceylon.compiler.typechecker.tree.Tree.AttributeDeclaration)1 MethodDeclaration (com.redhat.ceylon.compiler.typechecker.tree.Tree.MethodDeclaration)1 Return (com.redhat.ceylon.compiler.typechecker.tree.Tree.Return)1 ClassAlias (com.redhat.ceylon.model.typechecker.model.ClassAlias)1 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)1 Parameter (com.redhat.ceylon.model.typechecker.model.Parameter)1