use of com.redhat.ceylon.compiler.java.codegen.recovery.Drop in project ceylon-compiler by ceylon.
the class CeylonVisitor method visit.
public void visit(Tree.AnyMethod decl) {
TransformationPlan plan = gen.errors().hasDeclarationAndMarkBrokenness(decl);
if (plan instanceof Drop) {
return;
}
if (!acceptDeclaration(decl))
return;
int annots = gen.checkCompilerAnnotations(decl, defs);
if (Decl.withinClassOrInterface(decl) && (!Decl.isDeferred(decl) || Decl.isCaptured(decl))) {
classBuilder.method(decl, plan);
} else {
appendList(gen.classGen().transformWrappedMethod(decl, plan));
}
gen.resetCompilerAnnotations(annots);
}
use of com.redhat.ceylon.compiler.java.codegen.recovery.Drop in project ceylon-compiler by ceylon.
the class CeylonVisitor method visit.
public void visit(Tree.AttributeDeclaration decl) {
TransformationPlan plan = gen.errors().hasDeclarationAndMarkBrokenness(decl);
if (plan instanceof Drop) {
return;
}
// To accept this method it is either not native, native for this
// backend or it's a native header with an implementation and there
// is no native implementation specifically for this backend
boolean accept = acceptDeclaration(decl);
if (!accept)
return;
int annots = gen.checkCompilerAnnotations(decl, defs);
if (Decl.withinClassOrInterface(decl) && !Decl.isLocalToInitializer(decl)) {
// Class attributes
gen.classGen().transform(decl, classBuilder);
} else if (Decl.isToplevel(decl)) {
topattrBuilder.add(decl);
} else if ((Decl.isLocal(decl)) && ((Decl.isCaptured(decl) && Decl.isVariable(decl)) || Decl.isTransient(decl) || Decl.hasSetter(decl))) {
// Captured local attributes get turned into an inner getter/setter class
appendList(gen.transform(decl));
} else {
// All other local attributes
appendList(gen.statementGen().transform(decl));
}
gen.resetCompilerAnnotations(annots);
}
use of com.redhat.ceylon.compiler.java.codegen.recovery.Drop in project ceylon-compiler by ceylon.
the class CeylonVisitor method visit.
public void visit(Tree.ObjectDefinition decl) {
TransformationPlan plan = gen.errors().hasDeclarationAndMarkBrokenness(decl);
if (plan instanceof Drop) {
return;
}
if (skipHeaderMergeLater(decl)) {
return;
}
// To accept this object it is either not native or native for this backend
if (!acceptDeclaration(decl))
return;
int annots = gen.checkCompilerAnnotations(decl, defs);
if (Decl.withinClass(decl)) {
classBuilder.defs(gen.classGen().transformObjectDefinition(decl, classBuilder));
} else {
appendList(gen.classGen().transformObjectDefinition(decl, null));
}
gen.resetCompilerAnnotations(annots);
}
use of com.redhat.ceylon.compiler.java.codegen.recovery.Drop in project ceylon-compiler by ceylon.
the class CeylonVisitor method visit.
public void visit(Tree.AttributeGetterDefinition decl) {
TransformationPlan plan = gen.errors().hasDeclarationAndMarkBrokenness(decl);
if (plan instanceof Drop) {
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) && !Decl.isLocalToInitializer(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);
}
use of com.redhat.ceylon.compiler.java.codegen.recovery.Drop 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);
}
Aggregations