Skip to content

Commit f0cbcd6

Browse files
committed
addressed PR feedback
1 parent 0fdb207 commit f0cbcd6

11 files changed

Lines changed: 21 additions & 25 deletions

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11115,9 +11115,9 @@ module ts {
1111511115
return hasProperty(globals, name);
1111611116
}
1111711117

11118-
function isUnknownIdentifier(location: Node, name: string): boolean {
11119-
Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location");
11120-
return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
11118+
function resolvesToSomeValue(location: Node, name: string): boolean {
11119+
Debug.assert(!nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location");
11120+
return !!resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
1112111121
}
1112211122

1112311123
function getBlockScopedVariableId(n: Identifier): number {
@@ -11161,7 +11161,7 @@ module ts {
1116111161
isSymbolAccessible,
1116211162
isEntityNameVisible,
1116311163
getConstantValue,
11164-
isUnknownIdentifier,
11164+
resolvesToSomeValue,
1116511165
collectLinkedAliases,
1116611166
getBlockScopedVariableId,
1116711167
};

src/compiler/emitter.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ module ts {
8888
return true;
8989
}
9090

91-
function isUnknownNameInEnclosingScope(name: string, location: Node): boolean {
92-
return resolver.isUnknownIdentifier(location, name);
93-
}
94-
9591
function emitJavaScript(jsFilePath: string, root?: SourceFile) {
9692
let writer = createTextWriter(newLine);
9793
let write = writer.write;
@@ -254,7 +250,7 @@ module ts {
254250
let tempName: string;
255251
if (tempVariableKind !== TempVariableKind.auto && !(predefinedTempsInUse & tempVariableKind)) {
256252
tempName = tempVariableKind === TempVariableKind._i ? "_i" : "_n";
257-
if (resolver.isUnknownIdentifier(location, tempName)) {
253+
if (!resolver.resolvesToSomeValue(location, tempName)) {
258254
predefinedTempsInUse |= tempVariableKind;
259255
return tempName;
260256
}
@@ -273,8 +269,8 @@ module ts {
273269
}
274270

275271
tempCount++;
276-
277-
} while (!resolver.isUnknownIdentifier(location, tempName));
272+
}
273+
while (resolver.resolvesToSomeValue(location, tempName));
278274

279275
return tempName;
280276
}
@@ -2817,7 +2813,7 @@ module ts {
28172813
: blockScopeContainer.parent;
28182814

28192815
var hasConflictsInEnclosingScope =
2820-
!resolver.isUnknownIdentifier(parent, (<Identifier>node).text) ||
2816+
resolver.resolvesToSomeValue(parent, (<Identifier>node).text) ||
28212817
nameConflictsWithSomeTempVariable((<Identifier>node).text);
28222818

28232819
if (hasConflictsInEnclosingScope) {

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ module ts {
12191219
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
12201220
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
12211221
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
1222-
isUnknownIdentifier(location: Node, name: string): boolean;
1222+
resolvesToSomeValue(location: Node, name: string): boolean;
12231223
getBlockScopedVariableId(node: Identifier): number;
12241224
}
12251225

tests/baselines/reference/APISample_compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ declare module "typescript" {
953953
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
954954
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
955955
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
956-
isUnknownIdentifier(location: Node, name: string): boolean;
956+
resolvesToSomeValue(location: Node, name: string): boolean;
957957
getBlockScopedVariableId(node: Identifier): number;
958958
}
959959
const enum SymbolFlags {

tests/baselines/reference/APISample_compile.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,8 +3111,8 @@ declare module "typescript" {
31113111
>PropertyAccessExpression : PropertyAccessExpression
31123112
>ElementAccessExpression : ElementAccessExpression
31133113

3114-
isUnknownIdentifier(location: Node, name: string): boolean;
3115-
>isUnknownIdentifier : (location: Node, name: string) => boolean
3114+
resolvesToSomeValue(location: Node, name: string): boolean;
3115+
>resolvesToSomeValue : (location: Node, name: string) => boolean
31163116
>location : Node
31173117
>Node : Node
31183118
>name : string

tests/baselines/reference/APISample_linter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ declare module "typescript" {
984984
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
985985
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
986986
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
987-
isUnknownIdentifier(location: Node, name: string): boolean;
987+
resolvesToSomeValue(location: Node, name: string): boolean;
988988
getBlockScopedVariableId(node: Identifier): number;
989989
}
990990
const enum SymbolFlags {

tests/baselines/reference/APISample_linter.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,8 +3257,8 @@ declare module "typescript" {
32573257
>PropertyAccessExpression : PropertyAccessExpression
32583258
>ElementAccessExpression : ElementAccessExpression
32593259

3260-
isUnknownIdentifier(location: Node, name: string): boolean;
3261-
>isUnknownIdentifier : (location: Node, name: string) => boolean
3260+
resolvesToSomeValue(location: Node, name: string): boolean;
3261+
>resolvesToSomeValue : (location: Node, name: string) => boolean
32623262
>location : Node
32633263
>Node : Node
32643264
>name : string

tests/baselines/reference/APISample_transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ declare module "typescript" {
985985
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
986986
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
987987
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
988-
isUnknownIdentifier(location: Node, name: string): boolean;
988+
resolvesToSomeValue(location: Node, name: string): boolean;
989989
getBlockScopedVariableId(node: Identifier): number;
990990
}
991991
const enum SymbolFlags {

tests/baselines/reference/APISample_transform.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,8 +3207,8 @@ declare module "typescript" {
32073207
>PropertyAccessExpression : PropertyAccessExpression
32083208
>ElementAccessExpression : ElementAccessExpression
32093209

3210-
isUnknownIdentifier(location: Node, name: string): boolean;
3211-
>isUnknownIdentifier : (location: Node, name: string) => boolean
3210+
resolvesToSomeValue(location: Node, name: string): boolean;
3211+
>resolvesToSomeValue : (location: Node, name: string) => boolean
32123212
>location : Node
32133213
>Node : Node
32143214
>name : string

tests/baselines/reference/APISample_watcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ declare module "typescript" {
10221022
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
10231023
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
10241024
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
1025-
isUnknownIdentifier(location: Node, name: string): boolean;
1025+
resolvesToSomeValue(location: Node, name: string): boolean;
10261026
getBlockScopedVariableId(node: Identifier): number;
10271027
}
10281028
const enum SymbolFlags {

0 commit comments

Comments
 (0)