(context ParsingContext)
| 754 | } |
| 755 | |
| 756 | func (p *Parser) parsingContextErrors(context ParsingContext) { |
| 757 | switch context { |
| 758 | case PCSourceElements: |
| 759 | if p.token == ast.KindDefaultKeyword { |
| 760 | p.parseErrorAtCurrentToken(diagnostics.X_0_expected, "export") |
| 761 | } else { |
| 762 | p.parseErrorAtCurrentToken(diagnostics.Declaration_or_statement_expected) |
| 763 | } |
| 764 | case PCBlockStatements: |
| 765 | p.parseErrorAtCurrentToken(diagnostics.Declaration_or_statement_expected) |
| 766 | case PCSwitchClauses: |
| 767 | p.parseErrorAtCurrentToken(diagnostics.X_case_or_default_expected) |
| 768 | case PCSwitchClauseStatements: |
| 769 | p.parseErrorAtCurrentToken(diagnostics.Statement_expected) |
| 770 | case PCRestProperties, PCTypeMembers: |
| 771 | p.parseErrorAtCurrentToken(diagnostics.Property_or_signature_expected) |
| 772 | case PCClassMembers: |
| 773 | p.parseErrorAtCurrentToken(diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected) |
| 774 | case PCEnumMembers: |
| 775 | p.parseErrorAtCurrentToken(diagnostics.Enum_member_expected) |
| 776 | case PCHeritageClauseElement: |
| 777 | p.parseErrorAtCurrentToken(diagnostics.Expression_expected) |
| 778 | case PCVariableDeclarations: |
| 779 | if ast.IsKeyword(p.token) { |
| 780 | p.parseErrorAtCurrentToken(diagnostics.X_0_is_not_allowed_as_a_variable_declaration_name, scanner.TokenToString(p.token)) |
| 781 | } else { |
| 782 | p.parseErrorAtCurrentToken(diagnostics.Variable_declaration_expected) |
| 783 | } |
| 784 | case PCObjectBindingElements: |
| 785 | p.parseErrorAtCurrentToken(diagnostics.Property_destructuring_pattern_expected) |
| 786 | case PCArrayBindingElements: |
| 787 | p.parseErrorAtCurrentToken(diagnostics.Array_element_destructuring_pattern_expected) |
| 788 | case PCArgumentExpressions: |
| 789 | p.parseErrorAtCurrentToken(diagnostics.Argument_expression_expected) |
| 790 | case PCObjectLiteralMembers: |
| 791 | p.parseErrorAtCurrentToken(diagnostics.Property_assignment_expected) |
| 792 | case PCArrayLiteralMembers: |
| 793 | p.parseErrorAtCurrentToken(diagnostics.Expression_or_comma_expected) |
| 794 | case PCJSDocParameters: |
| 795 | p.parseErrorAtCurrentToken(diagnostics.Parameter_declaration_expected) |
| 796 | case PCParameters: |
| 797 | if ast.IsKeyword(p.token) { |
| 798 | p.parseErrorAtCurrentToken(diagnostics.X_0_is_not_allowed_as_a_parameter_name, scanner.TokenToString(p.token)) |
| 799 | } else { |
| 800 | p.parseErrorAtCurrentToken(diagnostics.Parameter_declaration_expected) |
| 801 | } |
| 802 | case PCTypeParameters: |
| 803 | p.parseErrorAtCurrentToken(diagnostics.Type_parameter_declaration_expected) |
| 804 | case PCTypeArguments: |
| 805 | p.parseErrorAtCurrentToken(diagnostics.Type_argument_expected) |
| 806 | case PCTupleElementTypes: |
| 807 | p.parseErrorAtCurrentToken(diagnostics.Type_expected) |
| 808 | case PCHeritageClauses: |
| 809 | p.parseErrorAtCurrentToken(diagnostics.Unexpected_token_expected) |
| 810 | case PCImportOrExportSpecifiers: |
| 811 | if p.token == ast.KindFromKeyword { |
| 812 | p.parseErrorAtCurrentToken(diagnostics.X_0_expected, "}") |
| 813 | } else { |
no test coverage detected