示例#1
0
 public SwitchExpressionArmBinder(
     SwitchExpressionArmSyntax arm,
     ExpressionVariableBinder armScopeBinder,
     SwitchExpressionBinder switchExpressionBinder
     ) : base(armScopeBinder)
 {
     this._arm                    = arm;
     this._armScopeBinder         = armScopeBinder;
     this._switchExpressionBinder = switchExpressionBinder;
 }
示例#2
0
        public override void VisitSwitchExpression(SwitchExpressionSyntax node)
        {
            var switchExpressionBinder = new SwitchExpressionBinder(node, _enclosing);

            AddToMap(node, switchExpressionBinder);
            Visit(node.GoverningExpression, switchExpressionBinder);
            foreach (SwitchExpressionArmSyntax arm in node.Arms)
            {
                var armScopeBinder = new ExpressionVariableBinder(arm, switchExpressionBinder);
                var armBinder      = new SwitchExpressionArmBinder(arm, armScopeBinder, switchExpressionBinder);
                AddToMap(arm, armBinder);
                Visit(arm.Pattern, armBinder);
                if (arm.WhenClause != null)
                {
                    Visit(arm.WhenClause, armBinder);
                }

                Visit(arm.Expression, armBinder);
            }
        }