mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Do not create Name of the importSpecifier if it isnt identifier, to avoid creating missing symbols
Missing symbols are defined when the declaration doesnt have name, so if we created node for missing identifier it would end up binding symbol with name (Missing)
This commit is contained in:
@@ -4656,21 +4656,27 @@ module ts {
|
||||
// ImportSpecifier:
|
||||
// ImportedBinding
|
||||
// IdentifierName as ImportedBinding
|
||||
var isfirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier();
|
||||
var isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier();
|
||||
var start = scanner.getTokenPos();
|
||||
var identifierName = parseIdentifierName();
|
||||
if (token === SyntaxKind.AsKeyword) {
|
||||
node.propertyName = identifierName;
|
||||
parseExpected(SyntaxKind.AsKeyword);
|
||||
node.name = parseIdentifier();
|
||||
if (isIdentifier()) {
|
||||
node.name = parseIdentifierName();
|
||||
}
|
||||
else {
|
||||
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.name = identifierName;
|
||||
if (isfirstIdentifierNameNotAnIdentifier) {
|
||||
if (isFirstIdentifierNameNotAnIdentifier) {
|
||||
// Report error identifier expected
|
||||
parseErrorAtPosition(start, identifierName.end - start, Diagnostics.Identifier_expected);
|
||||
}
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user