use of org.eclipse.ceylon.model.typechecker.model.TypeDeclaration in project ceylon by eclipse.
the class ClassDoc method writeSubtypesHierarchy.
private void writeSubtypesHierarchy(List<TypeDeclaration> types, int level) throws IOException {
if (types.size() > 1) {
Collections.sort(types, ReferenceableComparatorByName.INSTANCE);
}
for (TypeDeclaration type : types) {
List<TypeDeclaration> subtypes = collectSubtypes(type);
writeTypeHierarchyLevel(type, !subtypes.isEmpty());
if (level == 0 && Util.isEnumerated(type)) {
around("span class='keyword'", " of");
}
open("div class='subhierarchy'");
writeSubtypesHierarchy(subtypes, level + 1);
// subhierarchy
close("div");
close("li", "ul");
}
}
use of org.eclipse.ceylon.model.typechecker.model.TypeDeclaration in project ceylon by eclipse.
the class ClassDoc method writeSuperTypeHierarchy.
private void writeSuperTypeHierarchy(List<TypeDeclaration> types, int level) throws IOException {
if (types.size() > 1) {
Collections.sort(types, ReferenceableComparatorByName.INSTANCE);
}
for (TypeDeclaration type : types) {
List<TypeDeclaration> supertypes = collectSupertypes(type);
writeTypeHierarchyLevel(type, !supertypes.isEmpty());
open("div class='subhierarchy'");
writeSuperTypeHierarchy(supertypes, level + 1);
// subhierarchy
close("div");
close("li", "ul");
}
}
use of org.eclipse.ceylon.model.typechecker.model.TypeDeclaration in project ceylon by eclipse.
the class Util method getSuperInterfaces.
public static List<TypeDeclaration> getSuperInterfaces(TypeDeclaration decl) {
Set<TypeDeclaration> superInterfaces = new HashSet<TypeDeclaration>();
for (Type satisfiedType : decl.getSatisfiedTypes()) {
superInterfaces.add(satisfiedType.getDeclaration());
superInterfaces.addAll(getSuperInterfaces(satisfiedType.getDeclaration()));
}
List<TypeDeclaration> list = new ArrayList<TypeDeclaration>();
list.addAll(superInterfaces);
removeDuplicates(list);
return list;
}
use of org.eclipse.ceylon.model.typechecker.model.TypeDeclaration in project ceylon by eclipse.
the class TypePrinter method abbreviateCallable.
public static boolean abbreviateCallable(Type pt) {
if (pt.isInterface()) {
TypeDeclaration dec = pt.getDeclaration();
Unit unit = dec.getUnit();
Interface callableDeclaration = unit.getCallableDeclaration();
return dec.equals(callableDeclaration) && pt.getTypeArgumentList().size() == 2 && pt.getTypeArgumentList().get(0) != null;
} else {
return false;
}
}
use of org.eclipse.ceylon.model.typechecker.model.TypeDeclaration in project ceylon by eclipse.
the class ExpressionVisitor method resolveBaseTypeExpression.
private TypeDeclaration resolveBaseTypeExpression(Tree.BaseTypeExpression that, boolean error) {
Tree.Identifier id = that.getIdentifier();
String name = name(id);
Scope scope = that.getScope();
TypeDeclaration type = getTypeDeclaration(scope, name, that.getSignature(), that.getEllipsis(), that.getUnit());
if (type == null) {
if (error && !dynamic && !isNativeForWrongBackend(scope, unit)) {
that.addError("type is not defined: '" + name + "'" + correctionMessage(name, scope, unit, cancellable), 102);
unit.setUnresolvedReferences();
}
} else {
type = (TypeDeclaration) handleAbstractionOrHeader(type, that, error);
that.setDeclaration(type);
if (error) {
if (checkConcreteClass(type, that)) {
if (checkVisibleConstructor(that, type)) {
checkBaseTypeAndConstructorVisibility(that, name, type);
}
}
}
}
return type;
}
Aggregations