Search in sources :

Example 1 with Referenceable

use of org.eclipse.ceylon.model.typechecker.model.Referenceable in project ceylon by eclipse.

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);
    }
}
Also used : CompilationUnit(org.eclipse.ceylon.compiler.typechecker.tree.Tree.CompilationUnit) Visitor(org.eclipse.ceylon.compiler.typechecker.tree.Visitor) AssertionVisitor(org.eclipse.ceylon.compiler.typechecker.util.AssertionVisitor) Referenceable(org.eclipse.ceylon.model.typechecker.model.Referenceable) Tree(org.eclipse.ceylon.compiler.typechecker.tree.Tree) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) PhasedUnit(org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit)

Aggregations

PhasedUnit (org.eclipse.ceylon.compiler.typechecker.context.PhasedUnit)1 Tree (org.eclipse.ceylon.compiler.typechecker.tree.Tree)1 CompilationUnit (org.eclipse.ceylon.compiler.typechecker.tree.Tree.CompilationUnit)1 Visitor (org.eclipse.ceylon.compiler.typechecker.tree.Visitor)1 AssertionVisitor (org.eclipse.ceylon.compiler.typechecker.util.AssertionVisitor)1 Referenceable (org.eclipse.ceylon.model.typechecker.model.Referenceable)1 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)1