(node)
| 88575 | } |
| 88576 | } |
| 88577 | function checkGrammarTypeOperatorNode(node) { |
| 88578 | if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { |
| 88579 | if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { |
| 88580 | return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); |
| 88581 | } |
| 88582 | var parent = ts.walkUpParenthesizedTypes(node.parent); |
| 88583 | if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { |
| 88584 | var host_2 = ts.getJSDocHost(parent); |
| 88585 | if (host_2) { |
| 88586 | parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2; |
| 88587 | } |
| 88588 | } |
| 88589 | switch (parent.kind) { |
| 88590 | case 254 /* SyntaxKind.VariableDeclaration */: |
| 88591 | var decl = parent; |
| 88592 | if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { |
| 88593 | return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); |
| 88594 | } |
| 88595 | if (!ts.isVariableDeclarationInVariableStatement(decl)) { |
| 88596 | return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement); |
| 88597 | } |
| 88598 | if (!(decl.parent.flags & 2 /* NodeFlags.Const */)) { |
| 88599 | return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); |
| 88600 | } |
| 88601 | break; |
| 88602 | case 167 /* SyntaxKind.PropertyDeclaration */: |
| 88603 | if (!ts.isStatic(parent) || |
| 88604 | !ts.hasEffectiveReadonlyModifier(parent)) { |
| 88605 | return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); |
| 88606 | } |
| 88607 | break; |
| 88608 | case 166 /* SyntaxKind.PropertySignature */: |
| 88609 | if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { |
| 88610 | return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); |
| 88611 | } |
| 88612 | break; |
| 88613 | default: |
| 88614 | return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); |
| 88615 | } |
| 88616 | } |
| 88617 | else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { |
| 88618 | if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { |
| 88619 | return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); |
| 88620 | } |
| 88621 | } |
| 88622 | } |
| 88623 | function checkGrammarForInvalidDynamicName(node, message) { |
| 88624 | if (isNonBindableDynamicName(node)) { |
| 88625 | return grammarErrorOnNode(node, message); |
no test coverage detected