Beispiel #1
0
        public IfElseStatement(ConditionalBlockStatement mainIf, ConditionalBlockStatement[] elseIfs,
                               StatementInfo info)
        {
            MainIf  = mainIf;
            ElseIfs = elseIfs;
            Info    = info;

            var children = new List <IStatement>(elseIfs.Length + 2);
            var branches = new List <IStatement>(elseIfs.Length + 2);

            if (mainIf != null)
            {
                children.Add(mainIf);
                branches.Add(mainIf.Statement);
            }

            foreach (var child in elseIfs)
            {
                if (child != null)
                {
                    children.Add(child);
                    branches.Add(child.Statement);
                }
            }

            TraversableChildren = children.ToArray();
            Branches            = branches.ToArray();
        }
Beispiel #2
0
        public IfElseStatement(ConditionalBlockStatement mainIf, StatementInfo info)
        {
            MainIf = mainIf;
            Info   = info;

            TraversableChildren = StatementHelpers.CreateChildren(mainIf);
            Branches            = new[] { mainIf.Statement };
        }
Beispiel #3
0
        public IfElseStatement(ConditionalBlockStatement mainIf, IStatement @else, StatementInfo info)
        {
            MainIf = mainIf;
            Else   = @else;
            Info   = info;

            TraversableChildren = StatementHelpers.CreateChildren(mainIf, @else);
            Branches            = mainIf?.Statement != null
                ? new[] { mainIf.Statement, @else }
                : new[] { @else };
        }