(node, isGlobalAugmentation)
| 85017 | } |
| 85018 | } |
| 85019 | function checkModuleAugmentationElement(node, isGlobalAugmentation) { |
| 85020 | var _a; |
| 85021 | switch (node.kind) { |
| 85022 | case 237 /* SyntaxKind.VariableStatement */: |
| 85023 | // error each individual name in variable statement instead of marking the entire variable statement |
| 85024 | for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { |
| 85025 | var decl = _b[_i]; |
| 85026 | checkModuleAugmentationElement(decl, isGlobalAugmentation); |
| 85027 | } |
| 85028 | break; |
| 85029 | case 271 /* SyntaxKind.ExportAssignment */: |
| 85030 | case 272 /* SyntaxKind.ExportDeclaration */: |
| 85031 | grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); |
| 85032 | break; |
| 85033 | case 265 /* SyntaxKind.ImportEqualsDeclaration */: |
| 85034 | case 266 /* SyntaxKind.ImportDeclaration */: |
| 85035 | grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); |
| 85036 | break; |
| 85037 | case 203 /* SyntaxKind.BindingElement */: |
| 85038 | case 254 /* SyntaxKind.VariableDeclaration */: |
| 85039 | var name = node.name; |
| 85040 | if (ts.isBindingPattern(name)) { |
| 85041 | for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { |
| 85042 | var el = _d[_c]; |
| 85043 | // mark individual names in binding pattern |
| 85044 | checkModuleAugmentationElement(el, isGlobalAugmentation); |
| 85045 | } |
| 85046 | break; |
| 85047 | } |
| 85048 | // falls through |
| 85049 | case 257 /* SyntaxKind.ClassDeclaration */: |
| 85050 | case 260 /* SyntaxKind.EnumDeclaration */: |
| 85051 | case 256 /* SyntaxKind.FunctionDeclaration */: |
| 85052 | case 258 /* SyntaxKind.InterfaceDeclaration */: |
| 85053 | case 261 /* SyntaxKind.ModuleDeclaration */: |
| 85054 | case 259 /* SyntaxKind.TypeAliasDeclaration */: |
| 85055 | if (isGlobalAugmentation) { |
| 85056 | return; |
| 85057 | } |
| 85058 | var symbol = getSymbolOfNode(node); |
| 85059 | if (symbol) { |
| 85060 | // module augmentations cannot introduce new names on the top level scope of the module |
| 85061 | // this is done it two steps |
| 85062 | // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error |
| 85063 | // 2. main check - report error if value declaration of the parent symbol is module augmentation) |
| 85064 | var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); |
| 85065 | if (!reportError) { |
| 85066 | // symbol should not originate in augmentation |
| 85067 | reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); |
| 85068 | } |
| 85069 | } |
| 85070 | break; |
| 85071 | } |
| 85072 | } |
| 85073 | function getFirstNonModuleExportsIdentifier(node) { |
| 85074 | switch (node.kind) { |
| 85075 | case 79 /* SyntaxKind.Identifier */: |
no test coverage detected