Search in sources :

Example 11 with Annotation

use of com.redhat.ceylon.model.typechecker.model.Annotation in project ceylon-compiler by ceylon.

the class ClassOrPackageDoc method writeAliases.

protected final void writeAliases(Declaration decl) throws IOException {
    Annotation see = Util.getAnnotation(decl.getUnit(), decl.getAnnotations(), "aliased");
    if (see == null)
        return;
    open("div class='aliased section'");
    around("span class='title'", "Aliases: ");
    open("span class='value'");
    boolean first = true;
    for (String target : see.getPositionalArguments()) {
        if (!first) {
            write(", ");
        } else {
            first = false;
        }
        open("code class='signature'");
        String cssClass = decl instanceof TypeDeclaration ? "type-identifier" : "identifier";
        open("span class='" + cssClass + "'");
        write(target);
        close("span");
        close("code");
    }
    close("span");
    close("div");
}
Also used : TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Annotation(com.redhat.ceylon.model.typechecker.model.Annotation)

Example 12 with Annotation

use of com.redhat.ceylon.model.typechecker.model.Annotation in project ceylon-compiler by ceylon.

the class ClassOrPackageDoc method writeSee.

protected final void writeSee(Declaration decl) throws IOException {
    Annotation see = Util.getAnnotation(decl.getUnit(), decl.getAnnotations(), "see");
    if (see == null)
        return;
    open("div class='see section'");
    around("span class='title'", "See also ");
    open("span class='value'");
    boolean first = true;
    for (String target : see.getPositionalArguments()) {
        if (!first) {
            write(", ");
        } else {
            first = false;
        }
        //TODO: add 'identifier' or 'type-identitier' CSS class
        linkRenderer().to(target).withinText(true).useScope(decl).printAbbreviated(false).printTypeParameters(false).write();
    }
    close("span");
    close("div");
}
Also used : Annotation(com.redhat.ceylon.model.typechecker.model.Annotation)

Example 13 with Annotation

use of com.redhat.ceylon.model.typechecker.model.Annotation in project ceylon-compiler by ceylon.

the class ClassOrPackageDoc method writeParameterAssertions.

private void writeParameterAssertions(Declaration decl, Map<Tree.Assertion, List<Tree.Condition>> parameterAssertions) throws IOException {
    if (parameterAssertions == null || parameterAssertions.isEmpty()) {
        return;
    }
    PhasedUnit pu = tool.getUnit(decl);
    open("div class='assertions' title='Parameter assertions'");
    open("ul");
    for (Tree.Assertion assertion : parameterAssertions.keySet()) {
        List<Annotation> annotations = new ArrayList<Annotation>();
        buildAnnotations(assertion.getAnnotationList(), annotations);
        String doc = Util.getRawDoc(decl.getUnit(), annotations);
        if (!Util.isEmpty(doc)) {
            open("li");
            write("<i class='icon-assertion'></i>");
            write(Util.wikiToHTML(doc, linkRenderer()));
            close("li");
        } else {
            for (Tree.Condition c : parameterAssertions.get(assertion)) {
                String sourceCode = getSourceCode(pu, c);
                open("li");
                write("<i class='icon-assertion'></i>");
                around("code", sourceCode);
                close("li");
            }
        }
    }
    close("ul");
    close("div");
}
Also used : ArrayList(java.util.ArrayList) Tree(com.redhat.ceylon.compiler.typechecker.tree.Tree) Annotation(com.redhat.ceylon.model.typechecker.model.Annotation) PhasedUnit(com.redhat.ceylon.compiler.typechecker.context.PhasedUnit)

Aggregations

Annotation (com.redhat.ceylon.model.typechecker.model.Annotation)13 ArrayList (java.util.ArrayList)5 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)3 NothingType (com.redhat.ceylon.model.typechecker.model.NothingType)3 PhasedUnit (com.redhat.ceylon.compiler.typechecker.context.PhasedUnit)2 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)2 LanguageAnnotation (com.redhat.ceylon.model.loader.LanguageAnnotation)2 Module (com.redhat.ceylon.model.typechecker.model.Module)2 Package (com.redhat.ceylon.model.typechecker.model.Package)2 TypeDeclaration (com.redhat.ceylon.model.typechecker.model.TypeDeclaration)2 TypedDeclaration (com.redhat.ceylon.model.typechecker.model.TypedDeclaration)2 JCTree (com.sun.tools.javac.tree.JCTree)2 JCAnnotation (com.sun.tools.javac.tree.JCTree.JCAnnotation)2 JCExpression (com.sun.tools.javac.tree.JCTree.JCExpression)2 ListBuffer (com.sun.tools.javac.util.ListBuffer)2 SourceDeclarationVisitor (com.redhat.ceylon.compiler.java.loader.SourceDeclarationVisitor)1 Node (com.redhat.ceylon.compiler.typechecker.tree.Node)1 Expression (com.redhat.ceylon.compiler.typechecker.tree.Tree.Expression)1 Visitor (com.redhat.ceylon.compiler.typechecker.tree.Visitor)1 Class (com.redhat.ceylon.model.typechecker.model.Class)1