Parse reserved identifiers as dotted names of ambient modules (#55282)

This commit is contained in:
Mateusz Burzyński
2023-08-28 23:48:20 +02:00
committed by GitHub
parent b5b6048bb3
commit fe70ec984e
11 changed files with 238 additions and 1 deletions

View File

@@ -8226,7 +8226,7 @@ namespace Parser {
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
const namespaceFlag = flags & NodeFlags.Namespace;
const name = parseIdentifier();
const name = flags & NodeFlags.NestedNamespace ? parseIdentifierName() : parseIdentifier();
const body = parseOptional(SyntaxKind.DotToken)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration
: parseModuleBlock();