Beispiel #1
0
 public override void CheckControlFlow()
 {
     if (Next != null)
     {
         Next.CheckControlFlow();
     }
 }
Beispiel #2
0
        public override void CheckControlFlow()
        {
            if (_returnsBranches.Count > 0 && _returnsBranches.First().HasReturn)
            {
                GenerateFind(new UnreachableCode(this, Words));
            }

            if (_returnsBranches.Count > 0)
            {
                _returnsBranches.Push(new Branch {
                    SemanticOperator = this, HasReturn = false
                });
            }

            if (Child != null)
            {
                Child.CheckControlFlow();
            }

            foreach (var elseIf in ElseIfList)
            {
                elseIf.CheckControlFlow();
            }

            if (Else != null)
            {
                Else.CheckControlFlow();
            }

            if (_returnsBranches.Count > 0)
            {
                bool   hasReturn = _returnsBranches.Pop().HasReturn;
                Branch branch    = _returnsBranches.First();
                branch.HasReturn = Else != null & hasReturn;
            }

            if (Next != null)
            {
                Next.CheckControlFlow();
            }
        }