Ejemplo n.º 1
0
        private IList <StatementNode> convertBlockStatementList(BlockStatementListContext blockStatementListContext)
        {
            if (blockStatementListContext == null)
            {
                return(CollectionUtils.emptyList <StatementNode>());
            }
            IList <StatementInBlockContext> statementsInBlock = blockStatementListContext._statements;

            StatementNode[] statements = new StatementNode[statementsInBlock.Count];

            for (var i = 0; i < statementsInBlock.Count; i++)
            {
                StatementContext statementContext = statementsInBlock[i].statement();
                if (statementContext != null)
                {
                    statements[i] = (StatementNode)VisitStatement(statementContext);
                }
                else
                {
                    LocalVariableDeclarationContext localVarCtx =
                        statementsInBlock[i].localVariableDeclaration();
                    statements[i] = (StatementNode)VisitLocalVariableDeclaration(localVarCtx);
                }
            }

            return(statements);
        }
Ejemplo n.º 2
0
 public override Tree VisitBlockStatementList(BlockStatementListContext context) =>
 throw new InvalidOperationException();