Pass sourceFile to getChildren in getTokenAtPositionWorker (#25505) (#25538)

For performance reasons, we should always pass sourceFile to getChildren
if available.
This commit is contained in:
Pi Lanningham
2018-07-09 21:15:40 -04:00
committed by Andy
parent e9e5ebee73
commit b3b6c3bdbc

View File

@@ -679,7 +679,7 @@ namespace ts {
let current: Node = sourceFile;
outer: while (true) {
// find the child that contains 'position'
for (const child of current.getChildren()) {
for (const child of current.getChildren(sourceFile)) {
const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, /*includeJsDoc*/ true);
if (start > position) {
// If this child begins after position, then all subsequent children will as well.