(node)
| 88773 | } |
| 88774 | } |
| 88775 | function checkGrammarVariableDeclaration(node) { |
| 88776 | if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { |
| 88777 | if (node.flags & 16777216 /* NodeFlags.Ambient */) { |
| 88778 | checkAmbientInitializer(node); |
| 88779 | } |
| 88780 | else if (!node.initializer) { |
| 88781 | if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) { |
| 88782 | return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer); |
| 88783 | } |
| 88784 | if (ts.isVarConst(node)) { |
| 88785 | return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); |
| 88786 | } |
| 88787 | } |
| 88788 | } |
| 88789 | if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { |
| 88790 | var message = node.initializer |
| 88791 | ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions |
| 88792 | : !node.type |
| 88793 | ? ts.Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations |
| 88794 | : ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; |
| 88795 | return grammarErrorOnNode(node.exclamationToken, message); |
| 88796 | } |
| 88797 | if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System && |
| 88798 | !(node.parent.parent.flags & 16777216 /* NodeFlags.Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* ModifierFlags.Export */)) { |
| 88799 | checkESModuleMarker(node.name); |
| 88800 | } |
| 88801 | var checkLetConstNames = (ts.isLet(node) || ts.isVarConst(node)); |
| 88802 | // 1. LexicalDeclaration : LetOrConst BindingList ; |
| 88803 | // It is a Syntax Error if the BoundNames of BindingList contains "let". |
| 88804 | // 2. ForDeclaration: ForDeclaration : LetOrConst ForBinding |
| 88805 | // It is a Syntax Error if the BoundNames of ForDeclaration contains "let". |
| 88806 | // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code |
| 88807 | // and its Identifier is eval or arguments |
| 88808 | return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); |
| 88809 | } |
| 88810 | function checkESModuleMarker(name) { |
| 88811 | if (name.kind === 79 /* SyntaxKind.Identifier */) { |
| 88812 | if (ts.idText(name) === "__esModule") { |
no test coverage detected