protected internal override Expression VisitSwitch(SwitchCSharpStatement node)
        {
            var switchValue = Visit(node.SwitchValue);

            Push(node.Variables);

            var res =
                node.Update(
                    switchValue,
                    VisitLabelTarget(node.BreakLabel),
                    VisitAndConvert(node.Variables, nameof(VisitSwitch)),
                    Visit(node.Cases, VisitSwitchCase)
                    );

            Pop();

            return(res);
        }
Пример #2
0
        protected internal override Expression VisitSwitch(SwitchCSharpStatement node)
        {
            // NB: The variables are not in scope of the switch value. In a LINQ expression tree, the ParameterExpressions
            //     could be reused in several nested scopes, so the same variables could be used within the switch value
            //     expression and bind to a declaration in a surrounding scope.

            var switchValue = Visit(node.SwitchValue);

            PushScope(node.Variables);

            var res =
                node.Update(
                    switchValue,
                    VisitLabelTarget(node.BreakLabel),
                    VisitAndConvert(node.Variables, nameof(VisitSwitch)),
                    Visit(node.Cases, VisitSwitchCase)
                    );

            PopScope(node.Variables);

            return(res);
        }
Пример #3
0
            protected internal override Expression VisitSwitch(SwitchCSharpStatement node)
            {
                Visited = true;

                return(base.VisitSwitch(node));
            }