@@ -13440,7 +13440,7 @@ namespace ts {
13440
13440
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
13441
13441
function getContextualTypeForObjectLiteralMethod(node: MethodDeclaration): Type {
13442
13442
Debug.assert(isObjectLiteralMethod(node));
13443
- if (isInsideWithStatementBody( node) ) {
13443
+ if (node.flags & NodeFlags.InWithStatement ) {
13444
13444
// We cannot answer semantic questions within a with block, do not proceed any further
13445
13445
return undefined;
13446
13446
}
@@ -13559,7 +13559,7 @@ namespace ts {
13559
13559
* @returns the contextual type of an expression.
13560
13560
*/
13561
13561
function getContextualType(node: Expression): Type | undefined {
13562
- if (isInsideWithStatementBody( node) ) {
13562
+ if (node.flags & NodeFlags.InWithStatement ) {
13563
13563
// We cannot answer semantic questions within a with block, do not proceed any further
13564
13564
return undefined;
13565
13565
}
@@ -23124,21 +23124,8 @@ namespace ts {
23124
23124
23125
23125
// Language service support
23126
23126
23127
- function isInsideWithStatementBody(node: Node): boolean {
23128
- if (node) {
23129
- while (node.parent) {
23130
- if (node.parent.kind === SyntaxKind.WithStatement && (<WithStatement>node.parent).statement === node) {
23131
- return true;
23132
- }
23133
- node = node.parent;
23134
- }
23135
- }
23136
-
23137
- return false;
23138
- }
23139
-
23140
23127
function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] {
23141
- if (isInsideWithStatementBody( location) ) {
23128
+ if (location.flags & NodeFlags.InWithStatement ) {
23142
23129
// We cannot answer semantic questions within a with block, do not proceed any further
23143
23130
return [];
23144
23131
}
@@ -23438,7 +23425,7 @@ namespace ts {
23438
23425
return isExternalModule(<SourceFile>node) ? getMergedSymbol(node.symbol) : undefined;
23439
23426
}
23440
23427
23441
- if (isInsideWithStatementBody( node) ) {
23428
+ if (node.flags & NodeFlags.InWithStatement ) {
23442
23429
// We cannot answer semantic questions within a with block, do not proceed any further
23443
23430
return undefined;
23444
23431
}
@@ -23546,7 +23533,7 @@ namespace ts {
23546
23533
}
23547
23534
23548
23535
function getTypeOfNode(node: Node): Type {
23549
- if (isInsideWithStatementBody( node) ) {
23536
+ if (node.flags & NodeFlags.InWithStatement ) {
23550
23537
// We cannot answer semantic questions within a with block, do not proceed any further
23551
23538
return unknownType;
23552
23539
}
0 commit comments