Bike.Interpreter.Interpreter.Walk C# (CSharp) Метод

Walk() публичный Метод

public Walk ( ArrayLiteral node ) : object
node ArrayLiteral
Результат object
        public override object Walk(ArrayLiteral node)
        {
            var array = new BikeArray();
            if (node.IsRange)
            {
                var from = node.Expressions[0].Accept(this);
                var fromValue = ((BikeNumber) from).Value;
                if ((fromValue % 1) != 0)
                    throw ErrorFactory.CreateTypeError("Array range initializer must start with a whole number");

                var end = node.Expressions[1].Accept(this);
                var endValue = ((BikeNumber)end).Value;
                if ((endValue % 1) != 0)
                    throw ErrorFactory.CreateTypeError("Array range initializer must end with a whole number");

                if (fromValue <= endValue)
                {
                    int index = 0;
                    for (var i = (int) fromValue; i < (int) endValue; i++)
                    {
                        array.Define((index++).ToString(), new BikeNumber(i));
                    }
                }
                else
                {
                    int index = 0;
                    for (var i = (int)fromValue; i > (int)endValue; i--)
                    {
                        array.Define((index++).ToString(), new BikeNumber(i));
                    }
                }
                return array;
            }
            for (int i = 0; i < node.Expressions.Count; i++)
            {
                var value = node.Expressions[i].Accept(this);
                array.Define(i.ToString(), value);
            }
            return array;
        }

Same methods

Interpreter::Walk ( AdditiveExpression node ) : object
Interpreter::Walk ( AndExpression node ) : object
Interpreter::Walk ( BreakStatement node ) : object
Interpreter::Walk ( CallExpression node ) : object
Interpreter::Walk ( CaseClause node ) : object
Interpreter::Walk ( ConditionalExpression node ) : object
Interpreter::Walk ( EmptyStatement node ) : object
Interpreter::Walk ( EqualityExpression node ) : object
Interpreter::Walk ( ExecExpression node ) : object
Interpreter::Walk ( Expression node ) : object
Interpreter::Walk ( ExpressionStatement node ) : object
Interpreter::Walk ( ForInStatement node ) : object
Interpreter::Walk ( FunctionDeclaration node ) : object
Interpreter::Walk ( FunctionExpression node ) : object
Interpreter::Walk ( Identifier node ) : object
Interpreter::Walk ( IfStatement node ) : object
Interpreter::Walk ( IndexSuffix node ) : object
Interpreter::Walk ( LeftAssignmentExpression node ) : object
Interpreter::Walk ( LoadStatement node ) : object
Interpreter::Walk ( MemberExpression node ) : object
Interpreter::Walk ( MultiplicativeExpression node ) : object
Interpreter::Walk ( NextStatement node ) : object
Interpreter::Walk ( ObjectLiteral node ) : object
Interpreter::Walk ( OrExpression node ) : object
Interpreter::Walk ( PrimitiveLiteral node ) : object
Interpreter::Walk ( RelationalExpression node ) : object
Interpreter::Walk ( ReturnStatement node ) : object
Interpreter::Walk ( SelfExpression node ) : object
Interpreter::Walk ( SourceElements node ) : object
Interpreter::Walk ( SourceUnitTree node ) : object
Interpreter::Walk ( StatementBlock node ) : object
Interpreter::Walk ( SwitchStatement node ) : object
Interpreter::Walk ( ThrowStatement node ) : object
Interpreter::Walk ( TryStatement node ) : object
Interpreter::Walk ( TypeDescriptor node ) : object
Interpreter::Walk ( TypeDescriptorSuffix node ) : object
Interpreter::Walk ( UnaryExpression node ) : object
Interpreter::Walk ( VariableDeclaration node ) : object
Interpreter::Walk ( VariableStatement node ) : object
Interpreter::Walk ( WhileStatement node ) : object