Search in sources :

Example 1 with RuntimeMetamodelAnnotationGenerator

use of org.eclipse.ceylon.compiler.js.util.TypeUtils.RuntimeMetamodelAnnotationGenerator in project ceylon by eclipse.

the class GenerateJsVisitor method visit.

@Override
public void visit(final Tree.TypeAliasDeclaration that) {
    // Don't even bother with nodes that have errors
    if (errVisitor.hasErrors(that))
        return;
    final TypeAlias d = that.getDeclarationModel();
    if (opts.isOptimize() && d.isClassOrInterfaceMember())
        return;
    comment(that);
    final String tname = names.createTempVariable();
    out(function, names.name(d), "{var ", tname, "=");
    TypeUtils.typeNameOrList(that, that.getTypeSpecifier().getType().getTypeModel(), this, false);
    out(";", tname, ".$crtmm$=");
    TypeUtils.encodeForRuntime(that, d, this, new RuntimeMetamodelAnnotationGenerator() {

        @Override
        public void generateAnnotations() {
            TypeUtils.outputAnnotationsFunction(that.getAnnotationList(), d, GenerateJsVisitor.this);
        }
    });
    out(";return ", tname, ";}");
    endLine();
    share(d);
}
Also used : TypeAlias(org.eclipse.ceylon.model.typechecker.model.TypeAlias) RuntimeMetamodelAnnotationGenerator(org.eclipse.ceylon.compiler.js.util.TypeUtils.RuntimeMetamodelAnnotationGenerator)

Aggregations

RuntimeMetamodelAnnotationGenerator (org.eclipse.ceylon.compiler.js.util.TypeUtils.RuntimeMetamodelAnnotationGenerator)1 TypeAlias (org.eclipse.ceylon.model.typechecker.model.TypeAlias)1