Example #1
0
 private bool CreateSwitchStatement(int startIndex, SwitchToken token)
 {
     int endIndex = FindSwitchEndIndex(startIndex + 1);
     if (endIndex >= 0)
     {
         int count = endIndex - startIndex - 1;
         var endOffset = endIndex < _statements.Count ? _statements [endIndex].StartOffset : this[endIndex-1].EndOffset;
         var statement = new SwitchStatement(this[startIndex].StartOffset, token.Expr, GetRange(startIndex + 1, count),
                                             endOffset);
         ReplaceRange(startIndex, endIndex - startIndex, statement);
         statement.ProcessChildren();
         return true;
     }
     return false;
 }