addressed PR feedback

This commit is contained in:
Vladimir Matveev 2015-03-24 12:28:05 -07:00
parent 0fdb2071ce
commit f0cbcd6782
11 changed files with 21 additions and 25 deletions

View file

@ -11115,9 +11115,9 @@ module ts {
return hasProperty(globals, name);
}
function isUnknownIdentifier(location: Node, name: string): boolean {
Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location");
return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
function resolvesToSomeValue(location: Node, name: string): boolean {
Debug.assert(!nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location");
return !!resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
}
function getBlockScopedVariableId(n: Identifier): number {
@ -11161,7 +11161,7 @@ module ts {
isSymbolAccessible,
isEntityNameVisible,
getConstantValue,
isUnknownIdentifier,
resolvesToSomeValue,
collectLinkedAliases,
getBlockScopedVariableId,
};

View file

@ -88,10 +88,6 @@ module ts {
return true;
}
function isUnknownNameInEnclosingScope(name: string, location: Node): boolean {
return resolver.isUnknownIdentifier(location, name);
}
function emitJavaScript(jsFilePath: string, root?: SourceFile) {
let writer = createTextWriter(newLine);
let write = writer.write;
@ -254,7 +250,7 @@ module ts {
let tempName: string;
if (tempVariableKind !== TempVariableKind.auto && !(predefinedTempsInUse & tempVariableKind)) {
tempName = tempVariableKind === TempVariableKind._i ? "_i" : "_n";
if (resolver.isUnknownIdentifier(location, tempName)) {
if (!resolver.resolvesToSomeValue(location, tempName)) {
predefinedTempsInUse |= tempVariableKind;
return tempName;
}
@ -273,8 +269,8 @@ module ts {
}
tempCount++;
} while (!resolver.isUnknownIdentifier(location, tempName));
}
while (resolver.resolvesToSomeValue(location, tempName));
return tempName;
}
@ -2817,7 +2813,7 @@ module ts {
: blockScopeContainer.parent;
var hasConflictsInEnclosingScope =
!resolver.isUnknownIdentifier(parent, (<Identifier>node).text) ||
resolver.resolvesToSomeValue(parent, (<Identifier>node).text) ||
nameConflictsWithSomeTempVariable((<Identifier>node).text);
if (hasConflictsInEnclosingScope) {

View file

@ -1219,7 +1219,7 @@ module ts {
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}

View file

@ -953,7 +953,7 @@ declare module "typescript" {
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {

View file

@ -3111,8 +3111,8 @@ declare module "typescript" {
>PropertyAccessExpression : PropertyAccessExpression
>ElementAccessExpression : ElementAccessExpression
isUnknownIdentifier(location: Node, name: string): boolean;
>isUnknownIdentifier : (location: Node, name: string) => boolean
resolvesToSomeValue(location: Node, name: string): boolean;
>resolvesToSomeValue : (location: Node, name: string) => boolean
>location : Node
>Node : Node
>name : string

View file

@ -984,7 +984,7 @@ declare module "typescript" {
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {

View file

@ -3257,8 +3257,8 @@ declare module "typescript" {
>PropertyAccessExpression : PropertyAccessExpression
>ElementAccessExpression : ElementAccessExpression
isUnknownIdentifier(location: Node, name: string): boolean;
>isUnknownIdentifier : (location: Node, name: string) => boolean
resolvesToSomeValue(location: Node, name: string): boolean;
>resolvesToSomeValue : (location: Node, name: string) => boolean
>location : Node
>Node : Node
>name : string

View file

@ -985,7 +985,7 @@ declare module "typescript" {
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {

View file

@ -3207,8 +3207,8 @@ declare module "typescript" {
>PropertyAccessExpression : PropertyAccessExpression
>ElementAccessExpression : ElementAccessExpression
isUnknownIdentifier(location: Node, name: string): boolean;
>isUnknownIdentifier : (location: Node, name: string) => boolean
resolvesToSomeValue(location: Node, name: string): boolean;
>resolvesToSomeValue : (location: Node, name: string) => boolean
>location : Node
>Node : Node
>name : string

View file

@ -1022,7 +1022,7 @@ declare module "typescript" {
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {

View file

@ -3380,8 +3380,8 @@ declare module "typescript" {
>PropertyAccessExpression : PropertyAccessExpression
>ElementAccessExpression : ElementAccessExpression
isUnknownIdentifier(location: Node, name: string): boolean;
>isUnknownIdentifier : (location: Node, name: string) => boolean
resolvesToSomeValue(location: Node, name: string): boolean;
>resolvesToSomeValue : (location: Node, name: string) => boolean
>location : Node
>Node : Node
>name : string