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

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

public Walk ( ForInStatement node ) : object
node ForInStatement
Результат object
        public override object Walk(ForInStatement node)
        {
            var collection = node.Collection.Accept(this);
            if (collection == null)
                throw ErrorFactory.CreateNullError("Collection");
            if (!typeof(IEnumerable).IsAssignableFrom(collection.GetType()))
                throw ErrorFactory.CreateTypeError(string.Format("Object {0} is not enumerable", collection));

            string id;
            bool hasDeclaration = false;
            if (node.VariableDeclaration == null)
            {
                id = ((Identifier)node.LeftHandSideExpression.Accept(this)).Value;
            }
            else
            {
                id = node.VariableDeclaration.Identifier.Value;
                hasDeclaration = true;
            }

            object result = null;
            Action body = delegate
                              {
                                  foreach (var element in (IEnumerable)collection)
                                  {
                                      Context.CurrentFrame.Assign(id, element);
                                      try { result = node.Body.Accept(this); }
                                      catch (Break) { break; }
                                      catch (Next) { continue; }
                                  }
                              };
            Action<ScopeFrame> init = scopeFrame => scopeFrame.Define(id, null);
            Context.OpenScopeFor(body, withInit: init, when: hasDeclaration);
            return result;
        }

Same methods

Interpreter::Walk ( AdditiveExpression node ) : object
Interpreter::Walk ( AndExpression node ) : object
Interpreter::Walk ( ArrayLiteral 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 ( 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