docs/libs/typescript.js
function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
            var start = enclosingNode.getStart(sourceFile);
            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
                return start;
            }
            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
            if (!precedingToken) {
                // no preceding token found - start from the beginning of enclosing node
                return enclosingNode.pos;
            }
            // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)
            // start from the beginning of enclosingNode to handle the entire 'originalRange'
            if (precedingToken.end >= originalRange.pos) {
                return enclosingNode.pos;
            }
            return precedingToken.end;
        }
function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
            var start = enclosingNode.getStart(sourceFile);
            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
                return start;
            }
            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
            if (!precedingToken) {
                // no preceding token found - start from the beginning of enclosing node
                return enclosingNode.pos;
            }
            // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)
            // start from the beginning of enclosingNode to handle the entire 'originalRange'
            if (precedingToken.end >= originalRange.pos) {
                return enclosingNode.pos;
            }
            return precedingToken.end;
        }
function getScanStartPosition ( enclosingNode , originalRange , sourceFile ) { var start = enclosingNode . getStart ( sourceFile ) ; if ( start === originalRange . pos && enclosingNode . end === originalRange . end ) { return start ; } var precedingToken = ts . findPrecedingToken ( originalRange . pos , sourceFile ) ; if ( ! precedingToken ) { // no preceding token found - start from the beginning of enclosing node return enclosingNode . pos ; } // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if ( precedingToken . end >= originalRange . pos ) { return enclosingNode . pos ; } return precedingToken . end ; }
Start of the original range might fall inside the comment - scanner will not yield appropriate results
This function will look for token that is located before the start of target range
and return its end as start position for the scanner.
Start of the original range might fall inside the comment - scanner will not yield appropriate results This function will look for token that is located before the start of target range and return its end as start position for the scanner .