net.jangaroo.jooc.backend
Class JsCodeGenerator
java.lang.Object
net.jangaroo.jooc.backend.CodeGeneratorBase
net.jangaroo.jooc.backend.JsCodeGenerator
- All Implemented Interfaces:
- AstVisitor
public class JsCodeGenerator
- extends CodeGeneratorBase
A visitor of the AST that generates executable JavaScript code on
a JsWriter.
| Methods inherited from class net.jangaroo.jooc.backend.CodeGeneratorBase |
visitAll, visitBinaryOpExpr, visitCommaSeparatedList, visitConditionalExpr, visitIfNotNull, visitIfNotNull, visitIsExpr, visitLiteralExpr, visitPostfixOpExpr, visitPredefinedTypeDeclaration, visitPrefixOpExpr, writeModifiers, writeOptSymbol, writeOptSymbol, writeSymbolReplacement |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PRIMITIVES
public static final Set<String> PRIMITIVES
JsCodeGenerator
public JsCodeGenerator(JsWriter out)
visitDotExpr
public void visitDotExpr(DotExpr dotExpr)
throws IOException
- Specified by:
visitDotExpr in interface AstVisitor- Overrides:
visitDotExpr in class CodeGeneratorBase
- Throws:
IOException
visitTypeRelation
public void visitTypeRelation(TypeRelation typeRelation)
throws IOException
- Throws:
IOException
visitAnnotationParameter
public void visitAnnotationParameter(AnnotationParameter annotationParameter)
throws IOException
- Throws:
IOException
visitExtends
public void visitExtends(Extends anExtends)
throws IOException
- Throws:
IOException
visitInitializer
public void visitInitializer(Initializer initializer)
throws IOException
- Throws:
IOException
visitObjectField
public void visitObjectField(ObjectField objectField)
throws IOException
- Throws:
IOException
visitForInitializer
public void visitForInitializer(ForInitializer forInitializer)
throws IOException
- Throws:
IOException
visitCompilationUnit
public void visitCompilationUnit(CompilationUnit compilationUnit)
throws IOException
- Throws:
IOException
visitIde
public void visitIde(Ide ide)
throws IOException
- Throws:
IOException
visitQualifiedIde
public void visitQualifiedIde(QualifiedIde qualifiedIde)
throws IOException
- Throws:
IOException
visitIdeWithTypeParam
public void visitIdeWithTypeParam(IdeWithTypeParam ideWithTypeParam)
throws IOException
- Throws:
IOException
visitNamespacedIde
public void visitNamespacedIde(NamespacedIde namespacedIde)
throws IOException
- Throws:
IOException
visitImplements
public void visitImplements(Implements anImplements)
throws IOException
- Throws:
IOException
visitType
public void visitType(Type type)
throws IOException
- Throws:
IOException
visitObjectLiteral
public void visitObjectLiteral(ObjectLiteral objectLiteral)
throws IOException
- Throws:
IOException
visitIdeExpression
public void visitIdeExpression(IdeExpr ideExpr)
throws IOException
- Throws:
IOException
visitParenthesizedExpr
public <T extends Expr> void visitParenthesizedExpr(ParenthesizedExpr<T> parenthesizedExpr)
throws IOException
- Throws:
IOException
visitArrayLiteral
public void visitArrayLiteral(ArrayLiteral arrayLiteral)
throws IOException
- Throws:
IOException
visitAssignmentOpExpr
public void visitAssignmentOpExpr(AssignmentOpExpr assignmentOpExpr)
throws IOException
- Throws:
IOException
visitInfixOpExpr
public void visitInfixOpExpr(InfixOpExpr infixOpExpr)
throws IOException
- Throws:
IOException
visitAsExpr
public void visitAsExpr(AsExpr asExpr)
throws IOException
- Throws:
IOException
visitArrayIndexExpr
public void visitArrayIndexExpr(ArrayIndexExpr arrayIndexExpr)
throws IOException
- Throws:
IOException
visitParameters
public void visitParameters(Parameters parameters)
throws IOException
- Specified by:
visitParameters in interface AstVisitor- Overrides:
visitParameters in class CodeGeneratorBase
- Throws:
IOException
visitFunctionExpr
public void visitFunctionExpr(FunctionExpr functionExpr)
throws IOException
- Throws:
IOException
getFunctionNameAsIde
public String getFunctionNameAsIde(FunctionExpr functionExpr)
generateFunTailCode
public void generateFunTailCode(FunctionExpr functionExpr)
throws IOException
- Throws:
IOException
getParameterInitializerCodeGenerator
public CodeGenerator getParameterInitializerCodeGenerator(Parameters params)
generateRestParamCode
public void generateRestParamCode(Parameter param,
int paramIndex)
throws IOException
- Throws:
IOException
generateBodyInitializerCode
public void generateBodyInitializerCode(Parameter param)
throws IOException
- Throws:
IOException
generateSignatureJsCode
public void generateSignatureJsCode(FunctionExpr functionExpr)
throws IOException
- Throws:
IOException
visitVectorLiteral
public void visitVectorLiteral(VectorLiteral vectorLiteral)
throws IOException
- Throws:
IOException
visitApplyExpr
public void visitApplyExpr(ApplyExpr applyExpr)
throws IOException
- Throws:
IOException
visitNewExpr
public void visitNewExpr(NewExpr newExpr)
throws IOException
- Throws:
IOException
visitClassBody
public void visitClassBody(ClassBody classBody)
throws IOException
- Throws:
IOException
visitBlockStatement
public void visitBlockStatement(BlockStatement blockStatement)
throws IOException
- Throws:
IOException
visitDefaultStatement
public void visitDefaultStatement(DefaultStatement defaultStatement)
throws IOException
- Throws:
IOException
visitLabeledStatement
public void visitLabeledStatement(LabeledStatement labeledStatement)
throws IOException
- Throws:
IOException
visitIfStatement
public void visitIfStatement(IfStatement ifStatement)
throws IOException
- Throws:
IOException
visitCaseStatement
public void visitCaseStatement(CaseStatement caseStatement)
throws IOException
- Throws:
IOException
visitTryStatement
public void visitTryStatement(TryStatement tryStatement)
throws IOException
- Throws:
IOException
visitCatch
public void visitCatch(Catch aCatch)
throws IOException
- Throws:
IOException
visitForInStatement
public void visitForInStatement(ForInStatement forInStatement)
throws IOException
- Throws:
IOException
visitWhileStatement
public void visitWhileStatement(WhileStatement whileStatement)
throws IOException
- Throws:
IOException
visitForStatement
public void visitForStatement(ForStatement forStatement)
throws IOException
- Throws:
IOException
visitDoStatement
public void visitDoStatement(DoStatement doStatement)
throws IOException
- Throws:
IOException
visitSwitchStatement
public void visitSwitchStatement(SwitchStatement switchStatement)
throws IOException
- Throws:
IOException
visitSemicolonTerminatedStatement
public void visitSemicolonTerminatedStatement(SemicolonTerminatedStatement semicolonTerminatedStatement)
throws IOException
- Throws:
IOException
visitContinueStatement
public void visitContinueStatement(ContinueStatement continueStatement)
throws IOException
- Throws:
IOException
visitBreakStatement
public void visitBreakStatement(BreakStatement breakStatement)
throws IOException
- Throws:
IOException
visitThrowStatement
public void visitThrowStatement(ThrowStatement throwStatement)
throws IOException
- Throws:
IOException
visitReturnStatement
public void visitReturnStatement(ReturnStatement returnStatement)
throws IOException
- Throws:
IOException
visitEmptyStatement
public void visitEmptyStatement(EmptyStatement emptyStatement)
throws IOException
- Throws:
IOException
visitEmptyDeclaration
public void visitEmptyDeclaration(EmptyDeclaration emptyDeclaration)
throws IOException
- Throws:
IOException
visitParameter
public void visitParameter(Parameter parameter)
throws IOException
- Throws:
IOException
visitVariableDeclaration
public void visitVariableDeclaration(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateVariableDeclarationStartCode
protected void generateVariableDeclarationStartCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateVarStartCode
protected void generateVarStartCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateFieldStartCode
protected void generateFieldStartCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateVariableDeclarationInitializerCode
protected void generateVariableDeclarationInitializerCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateFieldInitializerCode
protected void generateFieldInitializerCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateVariableDeclarationEndCode
protected void generateVariableDeclarationEndCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
generateFieldEndCode
protected void generateFieldEndCode(VariableDeclaration variableDeclaration)
throws IOException
- Throws:
IOException
visitFunctionDeclaration
public void visitFunctionDeclaration(FunctionDeclaration functionDeclaration)
throws IOException
- Throws:
IOException
visitClassDeclaration
public void visitClassDeclaration(ClassDeclaration classDeclaration)
throws IOException
- Throws:
IOException
generateInitCode
public void generateInitCode(VariableDeclaration field,
boolean endWithSemicolon)
throws IOException
- Throws:
IOException
visitNamespacedDeclaration
public void visitNamespacedDeclaration(NamespacedDeclaration namespacedDeclaration)
throws IOException
- Throws:
IOException
visitPackageDeclaration
public void visitPackageDeclaration(PackageDeclaration packageDeclaration)
throws IOException
- Throws:
IOException
visitSuperConstructorCallStatement
public void visitSuperConstructorCallStatement(SuperConstructorCallStatement superConstructorCallStatement)
throws IOException
- Throws:
IOException
visitAnnotation
public void visitAnnotation(Annotation annotation)
throws IOException
- Throws:
IOException
visitUseNamespaceDirective
public void visitUseNamespaceDirective(UseNamespaceDirective useNamespaceDirective)
throws IOException
- Throws:
IOException
visitImportDirective
public void visitImportDirective(ImportDirective importDirective)
throws IOException
- Throws:
IOException
Copyright © 2002-2012 CoreMedia AG. All Rights Reserved.