Ejemplo n.º 1
0
        // YieldStatement
        private Statement Rewrite(YieldStatement node)
        {
            Expression expression = RewriteExpressionFreeTemps(node.Expression);

            // Yield needs empty stack too, so rewrite it always
            return(Ast.Yield(node.Span, expression));
        }
Ejemplo n.º 2
0
 // YieldStatement
 private void DefaultWalk(YieldStatement node)
 {
     if (Walk(node))
     {
         WalkNode(node.Expression);
     }
     PostWalk(node);
 }
Ejemplo n.º 3
0
        protected internal override void PostWalk(YieldStatement node)
        {
            // Assign the yield statement index for codegen
            int index = _topTargets.Count;
            TargetLabel label = new TargetLabel();
            node.Target = new YieldTarget(index, label);

            foreach (ExceptionBlock eb in _tryBlocks) {
                // The exception statement must determine
                // the label for the enclosing code to jump to
                // to return to the given yield target

                label = eb.AddYieldTarget(label, index);
            }

            // Insert the top target to the top yields
            Debug.Assert(_topTargets.Count == index);
            _topTargets.Add(new YieldTarget(index, label));
        }
Ejemplo n.º 4
0
        protected internal override void PostWalk(YieldStatement node)
        {
            // Assign the yield statement index for codegen
            int         index = _topTargets.Count;
            TargetLabel label = new TargetLabel();

            node.Target = new YieldTarget(index, label);

            foreach (ExceptionBlock eb in _tryBlocks)
            {
                // The exception statement must determine
                // the label for the enclosing code to jump to
                // to return to the given yield target

                label = eb.AddYieldTarget(label, index);
            }

            // Insert the top target to the top yields
            Debug.Assert(_topTargets.Count == index);
            _topTargets.Add(new YieldTarget(index, label));
        }
Ejemplo n.º 5
0
 protected internal override bool Walk(YieldStatement node)
 {
     _result.Yield = true;
     return(true);
 }
Ejemplo n.º 6
0
 // YieldStatement
 private void DefaultWalk(YieldStatement node)
 {
     if (Walk(node)) {
         WalkNode(node.Expression);
     }
     PostWalk(node);
 }
Ejemplo n.º 7
0
 protected internal override bool Walk(YieldStatement node)
 {
     _result.Yield = true;
     return true;
 }
Ejemplo n.º 8
0
 // YieldStatement
 private void Dump(YieldStatement node)
 {
     Out(".yield ");
     WalkNode(node.Expression);
     Out(";", Flow.NewLine);
 }
Ejemplo n.º 9
0
 // Yield statement triggers rewrite
 protected internal override void PostWalk(YieldStatement node)
 {
     _rewrite = true;
 }
Ejemplo n.º 10
0
 // Yield statement triggers rewrite
 protected internal override void PostWalk(YieldStatement node) {
     _rewrite = true;
 }