Beispiel #1
0
        public override Statement visit(VariableStatement variableStatement)
        {
            ArrayList statements = new ArrayList(0);

            for (int i = 0; i < variableStatement.declarations.Length; i++)
            {
                Expression expression = visitExpression(variableStatement.declarations[i]);

                if (expression != null)
                {
                    Statement statement = new ExpressionStatement(expression);
                    statement.setLineNumber(variableStatement.getLineNumber());
                    statements.Add(statement);
                }
            }

            if (statements.Count == 0)
            {
                return(new EmptyStatement());
            }
            else if (statements.Count == 1)
            {
                return((ExpressionStatement)statements[0]);
            }
            else
            {
                return(new BlockStatement(CompilerUtil.vectorToStatementArray(statements)));
            }
        }
Beispiel #2
0
 public virtual Statement visit(VariableStatement statement)
 {
     for (int i = 0; i < statement.declarations.Length; i++)
     {
         statement.declarations[i].visitExpression(this);
     }
     return(statement);
 }
        public virtual Statement visit(VariableStatement statement)
        {
            write("var (line = " + statement.getLineNumber() + ")");

            return(statement);
        }