internal SequencePointCollection(MemoryBlock block, DocumentHandle document)
 {
     _block    = block;
     _document = document;
 }
            public bool MoveNext()
            {
                if (_reader.RemainingBytes == 0)
                {
                    return(false);
                }

                DocumentHandle document = _current.Document;
                int            offset, deltaLines, deltaColumns, startLine;
                ushort         startColumn;

                if (_reader.Offset == 0)
                {
                    // header (skip local signature rid):
                    _reader.ReadCompressedInteger();

                    if (document.IsNil)
                    {
                        document = ReadDocumentHandle();
                    }
                    // IL offset:
                    offset = _reader.ReadCompressedInteger();
                }
                else
                {
                    // skip all document records and update the current document accordingly:
                    int deltaOffset;
                    while ((deltaOffset = _reader.ReadCompressedInteger()) == 0)
                    {
                        document = ReadDocumentHandle();
                    }

                    // IL offset:
                    offset = AddOffsets(_current.Offset, deltaOffset);
                }

                ReadDeltaLinesAndColumns(out deltaLines, out deltaColumns);

                // hidden
                if (deltaLines == 0 && deltaColumns == 0)
                {
                    _current = new SequencePoint(document, offset);
                    return(true);
                }

                // delta Start Line & Column:
                if (_previousNonHiddenStartLine < 0)
                {
                    Debug.Assert(_previousNonHiddenStartColumn == 0);

                    startLine   = ReadLine();
                    startColumn = ReadColumn();
                }
                else
                {
                    startLine   = AddLines(_previousNonHiddenStartLine, _reader.ReadCompressedSignedInteger());
                    startColumn = AddColumns(_previousNonHiddenStartColumn, _reader.ReadCompressedSignedInteger());
                }

                _previousNonHiddenStartLine   = startLine;
                _previousNonHiddenStartColumn = startColumn;

                _current = new SequencePoint(
                    document,
                    offset,
                    startLine,
                    startColumn,
                    AddLines(startLine, deltaLines),
                    AddColumns(startColumn, deltaColumns));

                return(true);
            }
Exemplo n.º 3
0
 public Document GetDocument(DocumentHandle handle)
 {
     return(new Document(this, handle));
 }