protected internal override Expression VisitForEach(ForEachCSharpStatement node) { // NB: The variable is not in scope of the collection. In a LINQ expression tree, the ParameterExpression // could be reused in several nested scopes, so the same variable could be used within the collection // expression and bind to a declaration in a surrounding scope. var collection = Visit(node.Collection); PushScope(node.Variables); var res = node.Update( VisitEnumeratorInfo(node.EnumeratorInfo), VisitLabelTarget(node.BreakLabel), VisitLabelTarget(node.ContinueLabel), VisitAndConvert(node.Variables, nameof(VisitForEach)), collection, VisitAndConvert(node.Conversion, nameof(VisitForEach)), Visit(node.Body), VisitAndConvert(node.Deconstruction, nameof(VisitForEach)), VisitAwaitInfo(node.AwaitInfo) ); PopScope(node.Variables); return(res); }
protected internal override Expression VisitForEach(ForEachCSharpStatement node) { // NB: If we do optimizations involving variables, we'll need to track scopes here. var variable = VisitAndConvert(node.Variable, nameof(VisitForEach)); var collection = Visit(node.Collection); var conversion = VisitAndConvert(node.Conversion, nameof(VisitForEach)); PushLabelInfo(node); var body = Visit(node.Body); PopLabelInfo(out LabelTarget @break, out LabelTarget @continue); return(node.Update(@break, @continue, variable, collection, conversion, body)); }
protected internal override Expression VisitForEach(ForEachCSharpStatement node) { // NB: If we do optimizations involving variables, we'll need to track scopes here. var variable = VisitAndConvert(node.Variable, nameof(VisitForEach)); var collection = Visit(node.Collection); var conversion = VisitAndConvert(node.Conversion, nameof(VisitForEach)); 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, variable, collection, conversion, body); }
protected internal override Expression VisitForEach(ForEachCSharpStatement node) { var collection = Visit(node.Collection); Push(new[] { node.Variable }); var res = node.Update( VisitLabelTarget(node.BreakLabel), VisitLabelTarget(node.ContinueLabel), VisitAndConvert(node.Variable, nameof(VisitForEach)), collection, VisitAndConvert(node.Conversion, nameof(VisitForEach)), Visit(node.Body) ); Pop(); return(res); }
protected internal override Expression VisitForEach(ForEachCSharpStatement node) { Visited = true; return(base.VisitForEach(node)); }