Exemplo n.º 1
0
        private Statement BuildStatementCore(StatementNode statementNode)
        {
            Statement statement = null;

            switch (statementNode.NodeType) {
                case ParseNodeType.Block:
                    statement = ProcessBlockStatement((BlockStatementNode)statementNode);
                    break;
                case ParseNodeType.EmptyStatement:
                    statement = new EmptyStatement();
                    break;
                case ParseNodeType.VariableDeclaration:
                case ParseNodeType.ConstDeclaration:
                    statement = ProcessVariableDeclarationStatement((VariableDeclarationNode)statementNode);
                    break;
                case ParseNodeType.Return:
                    statement = ProcessReturnStatement((ReturnNode)statementNode);
                    break;
                case ParseNodeType.ExpressionStatement:
                    statement = ProcessExpressionStatement((ExpressionStatementNode)statementNode);
                    break;
                case ParseNodeType.IfElse:
                    statement = ProcessIfElseStatement((IfElseNode)statementNode);
                    break;
                case ParseNodeType.While:
                    statement = ProcessWhileStatement((WhileNode)statementNode);
                    break;
                case ParseNodeType.DoWhile:
                    statement = ProcessDoWhileStatement((DoWhileNode)statementNode);
                    break;
                case ParseNodeType.For:
                    statement = ProcessForStatement((ForNode)statementNode);
                    break;
                case ParseNodeType.Foreach:
                    statement = ProcessForeachStatement((ForeachNode)statementNode);
                    break;
                case ParseNodeType.Switch:
                    statement = ProcessSwitchStatement((SwitchNode)statementNode);
                    break;
                case ParseNodeType.Break:
                    statement = new BreakStatement();
                    break;
                case ParseNodeType.Continue:
                    statement = new ContinueStatement();
                    break;
                case ParseNodeType.Throw:
                    statement = ProcessThrowStatement((ThrowNode)statementNode);
                    break;
                case ParseNodeType.Try:
                    statement = ProcessTryCatchFinallyStatement((TryNode)statementNode);
                    break;
            }
            return statement;
        }
Exemplo n.º 2
0
 private static void GenerateBreakStatement(ScriptGenerator generator, MemberSymbol symbol, BreakStatement statement)
 {
     ScriptTextWriter writer = generator.Writer;
     writer.Write("break;");
     writer.WriteNewLine();
 }