(node *ast.Node)
| 5219 | } |
| 5220 | |
| 5221 | func (c *Checker) checkModuleAugmentationElement(node *ast.Node) { |
| 5222 | switch node.Kind { |
| 5223 | case ast.KindVariableStatement: |
| 5224 | // error each individual name in variable statement instead of marking the entire variable statement |
| 5225 | for _, decl := range node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { |
| 5226 | c.checkModuleAugmentationElement(decl) |
| 5227 | } |
| 5228 | case ast.KindExportAssignment, ast.KindExportDeclaration: |
| 5229 | c.grammarErrorOnFirstToken(node, diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations) |
| 5230 | case ast.KindImportEqualsDeclaration: |
| 5231 | // import a = e.x; in module augmentation is ok, but not import a = require('fs) |
| 5232 | if ast.IsInternalModuleImportEqualsDeclaration(node) { |
| 5233 | break |
| 5234 | } |
| 5235 | fallthrough |
| 5236 | case ast.KindImportDeclaration, ast.KindJSImportDeclaration: |
| 5237 | c.grammarErrorOnFirstToken(node, diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module) |
| 5238 | case ast.KindBindingElement, ast.KindVariableDeclaration: |
| 5239 | name := node.Name() |
| 5240 | if ast.IsBindingPattern(name) { |
| 5241 | for _, el := range name.Elements() { |
| 5242 | // mark individual names in binding pattern |
| 5243 | c.checkModuleAugmentationElement(el) |
| 5244 | } |
| 5245 | } |
| 5246 | } |
| 5247 | } |
| 5248 | |
| 5249 | func (c *Checker) checkImportDeclaration(node *ast.ImportDeclarationNode) { |
| 5250 | // Grammar checking |
no test coverage detected