use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.
the class CeylonDocTool method buildNodesMaps.
private void buildNodesMaps() {
for (final PhasedUnit pu : phasedUnits) {
CompilationUnit cu = pu.getCompilationUnit();
Walker.walkCompilationUnit(new Visitor() {
public void visit(Tree.Declaration that) {
modelUnitMap.put(that.getDeclarationModel(), pu);
modelNodeMap.put(that.getDeclarationModel(), that);
super.visit(that);
}
public void visit(Tree.ObjectDefinition that) {
if (that.getDeclarationModel() != null && that.getDeclarationModel().getTypeDeclaration() != null) {
TypeDeclaration typeDecl = that.getDeclarationModel().getTypeDeclaration();
modelUnitMap.put(typeDecl, pu);
modelNodeMap.put(typeDecl, that);
}
super.visit(that);
}
public void visit(Tree.PackageDescriptor that) {
if (that.getImportPath() != null && that.getImportPath().getModel() != null) {
Referenceable model = that.getImportPath().getModel();
modelUnitMap.put(model, pu);
modelNodeMap.put(model, that);
}
super.visit(that);
}
public void visit(Tree.ModuleDescriptor that) {
if (that.getImportPath() != null && that.getImportPath().getModel() != null) {
Referenceable model = that.getImportPath().getModel();
modelUnitMap.put(model, pu);
modelNodeMap.put(model, that);
}
super.visit(that);
}
public void visit(Tree.SpecifierStatement that) {
modelUnitMap.put(that.getDeclaration(), pu);
modelNodeMap.put(that.getDeclaration(), that);
super.visit(that);
}
public void visit(Tree.Parameter param) {
parameterUnitMap.put(param.getParameterModel(), pu);
parameterNodeMap.put(param.getParameterModel(), param);
super.visit(param);
}
}, cu);
}
}
use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.
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 com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.
the class ClassDoc method writeQualifyingType.
private void writeQualifyingType(TypeDeclaration klass) throws IOException {
if (klass.isClassOrInterfaceMember()) {
TypeDeclaration container = (TypeDeclaration) klass.getContainer();
writeQualifyingType(container);
linkRenderer().to(container).useScope(klass).write();
write(".");
}
}
use of com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.
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 com.redhat.ceylon.model.typechecker.model.TypeDeclaration in project ceylon-compiler by ceylon.
the class ClassDoc method writeInheritedMembers.
private void writeInheritedMembers(MemberSpecification specification, String tableTitle, String rowTitle) throws IOException {
boolean first = true;
Map<TypeDeclaration, SortedMap<String, Declaration>> superClassInheritedMembersMap = superclassInheritedMembers.get(specification);
List<TypeDeclaration> superClasses = new ArrayList<TypeDeclaration>(superclassInheritedMembers.get(specification).keySet());
Collections.sort(superClasses, ReferenceableComparatorByName.INSTANCE);
for (TypeDeclaration superClass : superClasses) {
SortedMap<String, Declaration> inheritedMembers = superClassInheritedMembersMap.get(superClass);
if (first) {
first = false;
openTable(null, tableTitle, 1, false);
}
writeInheritedMembersRow(rowTitle, superClass, inheritedMembers);
}
Map<TypeDeclaration, SortedMap<String, Declaration>> superInterfaceInheritedMembersMap = interfaceInheritedMembers.get(specification);
List<TypeDeclaration> superInterfaces = new ArrayList<TypeDeclaration>(superInterfaceInheritedMembersMap.keySet());
Collections.sort(superInterfaces, ReferenceableComparatorByName.INSTANCE);
for (TypeDeclaration superInterface : superInterfaces) {
SortedMap<String, Declaration> members = superInterfaceInheritedMembersMap.get(superInterface);
if (members == null || members.isEmpty()) {
continue;
}
if (first) {
first = false;
openTable(null, tableTitle, 1, false);
}
writeInheritedMembersRow(rowTitle, superInterface, members);
}
if (!first) {
closeTable();
}
}
Aggregations