コード例 #1
0
        protected internal override Expression VisitFor(ForCSharpStatement node)
        {
            // NB: See notes in ForCSharpStatement.ReduceCore for the scoping rules applied here.

            var breakLabel    = VisitLabelTarget(node.BreakLabel);
            var continueLabel = VisitLabelTarget(node.ContinueLabel);

            PushScope(node.Variables);

            var variables    = VisitAndConvert(node.Variables, nameof(VisitFor));
            var initializers = Visit(node.Initializers);

            PushScope(node.Locals);

            var locals    = VisitAndConvert(node.Locals, nameof(VisitFor));
            var test      = Visit(node.Test);
            var iterators = Visit(node.Iterators);
            var body      = Visit(node.Body);

            PopScope(node.Locals);

            PopScope(node.Variables);

            return(node.Update(breakLabel, continueLabel, variables, initializers, test, iterators, body, locals));
        }
コード例 #2
0
        protected internal override Expression VisitFor(ForCSharpStatement node)
        {
            // NB: If we do optimizations involving variables, we'll need to track scopes here.

            var variables    = VisitAndConvert(node.Variables, nameof(VisitFor));
            var initializers = Visit(node.Initializers);
            var test         = Visit(node.Test);
            var iterators    = OptimizeIterators(Visit(node.Iterators));

            PushLabelInfo(node);

            var body = Visit(node.Body);

            PopLabelInfo(out LabelTarget @break, out LabelTarget @continue);

            return(node.Update(@break, @continue, variables, initializers, test, iterators, body));
        }
コード例 #3
0
        protected internal override Expression VisitFor(ForCSharpStatement node)
        {
            // NB: If we do optimizations involving variables, we'll need to track scopes here.

            var variables = VisitAndConvert(node.Variables, nameof(VisitFor));
            var initializers = Visit(node.Initializers);
            var test = Visit(node.Test);
            var iterators = OptimizeIterators(Visit(node.Iterators));

            PushLabelInfo(node);

            var body = Visit(node.Body);

            var @break = default(LabelTarget);
            var @continue = default(LabelTarget);
            PopLabelInfo(out @break, out @continue);

            return node.Update(@break, @continue, variables, initializers, test, iterators, body);
        }