-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change certain hasDynamicName checks to check the SyntaxKind instead
- Loading branch information
1 parent
9cb38fb
commit 25fcbe2
Showing
1 changed file
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7243,7 +7243,7 @@ module ts { | |
} | ||
|
||
function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { | ||
if (hasDynamicName(node)) { | ||
if (node.name.kind === SyntaxKind.ComputedPropertyName) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
JsonFreeman
Author
Contributor
|
||
checkComputedPropertyName(<ComputedPropertyName>node.name); | ||
} | ||
|
||
|
@@ -7254,7 +7254,7 @@ module ts { | |
// Grammar checking | ||
checkGrammarMethod(node); | ||
|
||
if (hasDynamicName(node)) { | ||
if (node.name.kind === SyntaxKind.ComputedPropertyName) { | ||
checkComputedPropertyName(<ComputedPropertyName>node.name); | ||
} | ||
|
||
|
@@ -8066,12 +8066,13 @@ module ts { | |
function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { | ||
checkSignatureDeclaration(node); | ||
|
||
if (hasDynamicName(node)) { | ||
if (node.name.kind === SyntaxKind.ComputedPropertyName) { | ||
// This check will account for methods in class/interface declarations, | ||
// as well as accessors in classes/object literals | ||
checkComputedPropertyName(<ComputedPropertyName>node.name); | ||
} | ||
else { | ||
|
||
if (!hasDynamicName(node)) { | ||
// first we want to check the local symbol that contain this declaration | ||
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol | ||
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode | ||
|
@@ -8300,12 +8301,11 @@ module ts { | |
function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { | ||
checkSourceElement(node.type); | ||
// For a computed property, just check the initializer and exit | ||
if (hasDynamicName(node)) { | ||
if (node.name.kind === SyntaxKind.ComputedPropertyName) { | ||
checkComputedPropertyName(<ComputedPropertyName>node.name); | ||
if (node.initializer) { | ||
checkExpressionCached(node.initializer); | ||
} | ||
return; | ||
} | ||
// For a binding pattern, check contained binding elements | ||
if (isBindingPattern(node.name)) { | ||
|
Why not use hasDynamicName anymore? hasDynamicName seems to do similar functionality