Addressed CR feedback.

This commit is contained in:
Daniel Rosenwasser
2015-03-18 12:08:09 -07:00
parent e49fc058b0
commit ec4278972d

View File

@@ -2618,9 +2618,13 @@ module ts {
entries: activeCompletionSession.entries
};
/**
* Finds the first node that "embraces" the position, so that one may
* accurately aggregate locals from the closest containing scope.
*/
function getScopeNode(initialToken: Node, position: number, sourceFile: SourceFile) {
var scope = initialToken;
while (scope && (isToken(scope) || !positionBelongsToNode(scope, position, sourceFile))) {
while (scope && !positionBelongsToNode(scope, position, sourceFile)) {
scope = scope.parent;
}
return scope;