Exemplo n.º 1
0
        void ITreeWalker.Visit(FunctionExpression expression)
        {
            var member = _member;

            _member = false;
            expression.Validate(this);

            InsertFunction(member, () => expression.Parameters.Accept(this), () =>
            {
                var body  = expression.Body;
                var block = body as BlockStatement;

                if (block != null)
                {
                    _loops.Push(false);

                    foreach (var statement in block.Statements)
                    {
                        statement.Accept(this);
                    }

                    _loops.Pop();
                }
                else
                {
                    var simple = body as SimpleStatement;
                    simple.Validate(this);
                    InsertReturn(() => simple.Expression.Accept(this));
                }
            });
        }
 void ITreeWalker.Visit(FunctionExpression expression)
 {
     expression.Validate(this);
     expression.Parameters.Accept(this);
     _loops.Push(null);
     expression.Body.Accept(this);
     _loops.Pop();
 }
Exemplo n.º 3
0
        void ITreeWalker.Visit(FunctionExpression expression)
        {
            var current = _operations.Count;

            expression.Validate(this);
            expression.Parameters.Accept(this);
            _loops.Push(default(LoopInfo));
            expression.Body.Accept(this);
            _loops.Pop();
            var operations = ExtractFrom(current);

            _operations.Add(new NewFuncOperation(operations));
        }
Exemplo n.º 4
0
        void ITreeWalker.Visit(FunctionExpression expression)
        {
            var member     = _member;
            var current    = _operations.Count;
            var parameters = expression.Parameters;

            _member = false;
            expression.Validate(this);
            parameters.Accept(this);
            _loops.Push(default(LoopInfo));
            expression.Body.Accept(this);
            _loops.Pop();
            var function = ExtractFunction(member, parameters.Names, current);

            _operations.Add(function);
        }