Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether [is after last statement] [the specified element].
        /// </summary>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <returns>
        /// <c>true</c> if [is after last statement] [the specified element]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsAfterLastStatement(IElement element)
        {
            var block = element.GetContainingElement(typeof(IBlock), true) as IBlock;
              if (block == null)
              {
            return false;
              }

              if (block.Statements.Count <= 0)
              {
            return true;
              }

              var statement = block.Statements[block.Statements.Count - 1];
              var range = statement.GetDocumentRange();

              var end = range.TextRange.StartOffset + range.TextRange.Length;
              if (end > element.GetTreeTextRange().StartOffset.Offset)
              {
            return false;
              }

              return true;
        }