Stop looking at control flow containers for this

References to `this` should not continue looking outside their immediate
container to narrow. Introduced by #11458, which allows narrowing of
captured variables inside methods of class expressions.
This commit is contained in:
Nathan Shively-Sanders
2017-04-05 11:02:42 -07:00
parent 9bfba73418
commit 924f536ba6

View File

@@ -11009,7 +11009,7 @@ namespace ts {
else if (flow.flags & FlowFlags.Start) {
// Check if we should continue with the control flow of the containing function.
const container = (<FlowStart>flow).container;
if (container && container !== flowContainer && reference.kind !== SyntaxKind.PropertyAccessExpression) {
if (container && container !== flowContainer && reference.kind !== SyntaxKind.PropertyAccessExpression && reference.kind !== SyntaxKind.ThisKeyword) {
flow = container.flowNode;
continue;
}