Beispiel #1
0
        public override D.CsStmt Concretize()
        {
            var result = new D.CsStmtList();
            var kw     = "if";

            foreach (var cond in _conditions)
            {
                var if1 = new D.CsComplexStmt
                {
                    Before = $"{kw} ({cond})"
                };
                if1.AddCode(_thenBranches[cond].Select(x => x.Concretize()));
                result.AddStmt(if1);
                kw = "else if";
            }

            if (_elseBranch.Count <= 0)
            {
                return(result);
            }
            {
                var if2 = new D.CsComplexStmt
                {
                    Before = "else"
                };
                if2.AddCode(_elseBranch.Select(x => x.Concretize()));
                result.AddStmt(if2);
            }
            return(result);
        }
Beispiel #2
0
        public override D.CsStmt Concretize()
        {
            var result = new D.CsStmtList();
            var kw     = "if";

            foreach (var cond in Conditions)
            {
                var if1 = new D.CsComplexStmt();
                if1.Before = $"{kw} ({cond})";
                if1.AddCode(ThenBranches[cond].Select(x => x.Concretize()));
                result.Stmts.Add(if1);
                kw = "else if";
            }
            if (ElseBranch.Count > 0)
            {
                var if2 = new D.CsComplexStmt();
                if2.Before = "else";
                if2.AddCode(ElseBranch.Select(x => x.Concretize()));
                result.Stmts.Add(if2);
            }
            return(result);
        }