Esempio n. 1
0
        public BoundDecisionDag GetDecisionDagForLowering(CSharpCompilation compilation)
        {
            BoundDecisionDag decisionDag = this.ReachabilityDecisionDag;

            if (decisionDag.ContainsAnySynthesizedNodes())
            {
                decisionDag = DecisionDagBuilder.CreateDecisionDagForSwitchStatement(
                    compilation,
                    this.Syntax,
                    this.Expression,
                    this.SwitchSections,
                    this.DefaultLabel?.Label ?? this.BreakLabel,
                    BindingDiagnosticBag.Discarded,
                    forLowering: true);
                Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
            }

            return(decisionDag);
        }
Esempio n. 2
0
        public BoundDecisionDag GetDecisionDagForLowering(CSharpCompilation compilation)
        {
            BoundDecisionDag decisionDag = this.ReachabilityDecisionDag;

            if (decisionDag.ContainsAnySynthesizedNodes())
            {
                decisionDag = DecisionDagBuilder.CreateDecisionDagForIsPattern(
                    compilation,
                    this.Syntax,
                    this.Expression,
                    this.Pattern,
                    this.WhenTrueLabel,
                    this.WhenFalseLabel,
                    BindingDiagnosticBag.Discarded,
                    forLowering: true);
                Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
            }

            return(decisionDag);
        }
        public BoundDecisionDag GetDecisionDagForLowering(CSharpCompilation compilation, out LabelSymbol?defaultLabel)
        {
            defaultLabel = this.DefaultLabel;

            BoundDecisionDag decisionDag = this.ReachabilityDecisionDag;

            if (decisionDag.ContainsAnySynthesizedNodes())
            {
                decisionDag = DecisionDagBuilder.CreateDecisionDagForSwitchExpression(
                    compilation,
                    this.Syntax,
                    this.Expression,
                    this.SwitchArms,
                    // there's no default label if the original switch is exhaustive.
                    // we generate a new label here because the new dag might not be.
                    defaultLabel ??= new GeneratedLabelSymbol("default"),
                    BindingDiagnosticBag.Discarded,
                    forLowering: true);
                Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
            }

            return(decisionDag);
        }