Search in sources :

Example 1 with Declaration

use of net.jangaroo.jooc.ast.Declaration in project jangaroo-tools by CoreMedia.

the class JsCodeGenerator method visitClassBody.

@Override
public void visitClassBody(ClassBody classBody) throws IOException {
    out.writeSymbolWhitespace(classBody.getLBrace());
    boolean inStaticInitializerBlock = false;
    for (Directive directive : classBody.getDirectives()) {
        final boolean isStaticInitializer = directive instanceof Statement && !(directive instanceof Declaration);
        if (isStaticInitializer) {
            inStaticInitializerBlock = beginStaticInitializer(out, inStaticInitializerBlock);
        } else {
            inStaticInitializerBlock = endStaticInitializer(out, inStaticInitializerBlock);
        }
        directive.visit(this);
    }
    endStaticInitializer(out, inStaticInitializerBlock);
    out.writeSymbolWhitespace(classBody.getRBrace());
}
Also used : ForInStatement(net.jangaroo.jooc.ast.ForInStatement) CaseStatement(net.jangaroo.jooc.ast.CaseStatement) WhileStatement(net.jangaroo.jooc.ast.WhileStatement) DoStatement(net.jangaroo.jooc.ast.DoStatement) SemicolonTerminatedStatement(net.jangaroo.jooc.ast.SemicolonTerminatedStatement) EmptyStatement(net.jangaroo.jooc.ast.EmptyStatement) SuperConstructorCallStatement(net.jangaroo.jooc.ast.SuperConstructorCallStatement) ReturnStatement(net.jangaroo.jooc.ast.ReturnStatement) ContinueStatement(net.jangaroo.jooc.ast.ContinueStatement) LabeledStatement(net.jangaroo.jooc.ast.LabeledStatement) SwitchStatement(net.jangaroo.jooc.ast.SwitchStatement) DefaultStatement(net.jangaroo.jooc.ast.DefaultStatement) Statement(net.jangaroo.jooc.ast.Statement) TryStatement(net.jangaroo.jooc.ast.TryStatement) BreakStatement(net.jangaroo.jooc.ast.BreakStatement) BlockStatement(net.jangaroo.jooc.ast.BlockStatement) IfStatement(net.jangaroo.jooc.ast.IfStatement) ForStatement(net.jangaroo.jooc.ast.ForStatement) ThrowStatement(net.jangaroo.jooc.ast.ThrowStatement) NamespaceDeclaration(net.jangaroo.jooc.ast.NamespaceDeclaration) ClassDeclaration(net.jangaroo.jooc.ast.ClassDeclaration) FunctionDeclaration(net.jangaroo.jooc.ast.FunctionDeclaration) IdeDeclaration(net.jangaroo.jooc.ast.IdeDeclaration) PackageDeclaration(net.jangaroo.jooc.ast.PackageDeclaration) Declaration(net.jangaroo.jooc.ast.Declaration) VariableDeclaration(net.jangaroo.jooc.ast.VariableDeclaration) EmptyDeclaration(net.jangaroo.jooc.ast.EmptyDeclaration) TypedIdeDeclaration(net.jangaroo.jooc.ast.TypedIdeDeclaration) UseNamespaceDirective(net.jangaroo.jooc.ast.UseNamespaceDirective) Directive(net.jangaroo.jooc.ast.Directive) ImportDirective(net.jangaroo.jooc.ast.ImportDirective)

Aggregations

BlockStatement (net.jangaroo.jooc.ast.BlockStatement)1 BreakStatement (net.jangaroo.jooc.ast.BreakStatement)1 CaseStatement (net.jangaroo.jooc.ast.CaseStatement)1 ClassDeclaration (net.jangaroo.jooc.ast.ClassDeclaration)1 ContinueStatement (net.jangaroo.jooc.ast.ContinueStatement)1 Declaration (net.jangaroo.jooc.ast.Declaration)1 DefaultStatement (net.jangaroo.jooc.ast.DefaultStatement)1 Directive (net.jangaroo.jooc.ast.Directive)1 DoStatement (net.jangaroo.jooc.ast.DoStatement)1 EmptyDeclaration (net.jangaroo.jooc.ast.EmptyDeclaration)1 EmptyStatement (net.jangaroo.jooc.ast.EmptyStatement)1 ForInStatement (net.jangaroo.jooc.ast.ForInStatement)1 ForStatement (net.jangaroo.jooc.ast.ForStatement)1 FunctionDeclaration (net.jangaroo.jooc.ast.FunctionDeclaration)1 IdeDeclaration (net.jangaroo.jooc.ast.IdeDeclaration)1 IfStatement (net.jangaroo.jooc.ast.IfStatement)1 ImportDirective (net.jangaroo.jooc.ast.ImportDirective)1 LabeledStatement (net.jangaroo.jooc.ast.LabeledStatement)1 NamespaceDeclaration (net.jangaroo.jooc.ast.NamespaceDeclaration)1 PackageDeclaration (net.jangaroo.jooc.ast.PackageDeclaration)1