use of org.eclipse.ceylon.model.typechecker.model.TypedDeclaration in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.AnyClass that) {
Class c = that.getDeclarationModel();
visitDeclaration(that, c);
Scope o = enterScope(c);
super.visit(that);
exitScope(o);
Tree.ParameterList pl = that.getParameterList();
if (pl != null) {
pl.getModel().setFirst(true);
c.addParameterList(pl.getModel());
}
// TODO: is this still necessary??
if (c.isClassOrInterfaceMember() && c.getContainer() instanceof TypedDeclaration) {
that.addUnsupportedError("nested classes of inner classes are not yet supported");
}
Tree.Identifier identifier = that.getIdentifier();
if (c.isAbstract() && c.isFinal()) {
that.addError("class may not be both 'abstract' and 'final': '" + name(identifier) + "'");
}
if (c.isFormal() && c.isFinal()) {
that.addError("class may not be both 'formal' and 'final': '" + name(identifier) + "'");
}
if (hasAnnotation(that.getAnnotationList(), "service", that.getUnit())) {
if (!c.getTypeParameters().isEmpty()) {
that.addError("service class may not be generic");
}
}
}
use of org.eclipse.ceylon.model.typechecker.model.TypedDeclaration in project ceylon by eclipse.
the class TypeArgumentVisitor method visit.
@Override
public void visit(Tree.TypedDeclaration that) {
TypedDeclaration dec = that.getDeclarationModel();
if (!(that instanceof Tree.Variable)) {
check(that.getType(), dec.isVariable() || dec.isLate(), dec);
}
if (dec.isParameter()) {
flip();
boolean topLevel = // i.e. toplevel parameter in a parameter declaration
parameterizedDeclaration == null;
if (topLevel) {
// TODO: to fix #1378 don't do this when the
// parameter dec occurs in any parameter
// list other than the first parameter
// list of the function
FunctionOrValue fov = (FunctionOrValue) dec;
parameterizedDeclaration = fov.getInitializerParameter().getDeclaration();
}
check(that.getType(), false, parameterizedDeclaration);
super.visit(that);
if (topLevel) {
parameterizedDeclaration = null;
}
flip();
} else {
super.visit(that);
}
}
use of org.eclipse.ceylon.model.typechecker.model.TypedDeclaration in project ceylon by eclipse.
the class AnnotationVisitor method visit.
@Override
public void visit(Tree.AnyMethod that) {
super.visit(that);
Function a = that.getDeclarationModel();
if (a.isAnnotation()) {
checkAnnotationConstructor(that, a);
}
TypedDeclaration m = that.getDeclarationModel();
Unit unit = that.getUnit();
checkAnnotations(that.getAnnotationList(), unit.getFunctionDeclarationType(), unit.getFunctionMetatype(m.getTypedReference()), that);
}
use of org.eclipse.ceylon.model.typechecker.model.TypedDeclaration in project ceylon by eclipse.
the class AnnotationVisitor method visit.
@Override
public void visit(Tree.AnyAttribute that) {
super.visit(that);
TypedDeclaration a = that.getDeclarationModel();
Unit unit = that.getUnit();
checkAnnotations(that.getAnnotationList(), unit.getValueDeclarationType(), unit.getValueMetatype(a.getTypedReference()), that);
}
use of org.eclipse.ceylon.model.typechecker.model.TypedDeclaration in project ceylon by eclipse.
the class AnnotationVisitor method visit.
@Override
public void visit(Tree.ObjectDefinition that) {
super.visit(that);
TypedDeclaration o = that.getDeclarationModel();
Unit unit = that.getUnit();
checkAnnotations(that.getAnnotationList(), unit.getValueDeclarationType(), unit.getValueMetatype(o.getTypedReference()), that);
}
Aggregations