private Statement GetTargetStatement(Statement node) {
     Statement targetNode = node;
     while (targetNode.Parent != null &&
         targetNode.Parent.GetEndIndex(_tree.LocationResolver) == node.GetEndIndex(_tree.LocationResolver)) {
         if (targetNode.Parent != null && targetNode.Parent.Parent is JsAst) {
             // https://nodejstools.codeplex.com/workitem/1102
             // We don't want to reformat the entire document just because someone
             // is doing something at the end of the document.
             break;
         }
         targetNode = targetNode.Parent;
     }
     return targetNode;
 }
 private void CheckStatement(Statement node) {
     if (_typedChar == ';' && node.GetEndIndex(_tree.LocationResolver) == _position) {
         // if(1)if(1)if(1)if(1)x+=2;
         // We want to reformat all of the if statements that are nested
         // so walk up the parent nodes as long as they are all terminated
         // at the same semicolon.                   
         Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver);
     }
 }