Make isDeclaration return 'true' on FunctionExpressions.
This commit is contained in:
parent
21fb559b53
commit
81b6588059
|
@ -10190,7 +10190,7 @@ module ts {
|
|||
}
|
||||
|
||||
function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol {
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) {
|
||||
if (isDeclarationOrCatchVariableName(entityName)) {
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
}
|
||||
|
||||
|
@ -10255,7 +10255,7 @@ module ts {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationOrCatchVariableName(node)) {
|
||||
// This is a declaration, call getSymbolOfNode
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
|
@ -10351,7 +10351,7 @@ module ts {
|
|||
return getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (isDeclarationOrCatchVariableName(node)) {
|
||||
var symbol = getSymbolInfo(node);
|
||||
return symbol && getTypeOfSymbol(symbol);
|
||||
}
|
||||
|
|
|
@ -706,6 +706,7 @@ module ts {
|
|||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -739,7 +740,7 @@ module ts {
|
|||
}
|
||||
|
||||
// True if the given identifier, string literal, or number literal is the name of a declaration node
|
||||
export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean {
|
||||
export function isDeclarationOrCatchVariableName(name: Node): boolean {
|
||||
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
|
||||
return false;
|
||||
}
|
||||
|
@ -751,7 +752,7 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
|
||||
if (isDeclaration(parent)) {
|
||||
return (<Declaration>parent).name === name;
|
||||
}
|
||||
|
||||
|
|
|
@ -4756,7 +4756,7 @@ module ts {
|
|||
|
||||
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
|
||||
function isWriteAccess(node: Node): boolean {
|
||||
if (node.kind === SyntaxKind.Identifier && isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
if (node.kind === SyntaxKind.Identifier && isDeclarationOrCatchVariableName(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4918,7 +4918,7 @@ module ts {
|
|||
else if (isInRightSideOfImport(node)) {
|
||||
return getMeaningFromRightHandSideOfImportEquals(node);
|
||||
}
|
||||
else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||
else if (isDeclarationOrCatchVariableName(node)) {
|
||||
return getMeaningFromDeclaration(node.parent);
|
||||
}
|
||||
else if (isTypeReference(node)) {
|
||||
|
|
Loading…
Reference in a new issue