mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00: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:
1 parent
c521fe434e
commit
d85581ba0e
1 file changed
+9
-3
@@ -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