Skip to content

Commit

Permalink
Add 12 more grammar errors (microsoft#47075)
Browse files Browse the repository at this point in the history
These are the last ones that I know of. They come from calls to
`grammarErrorOnFirstToken`.

Fixes part of microsoft#45349
Follow-up to microsoft#47067
  • Loading branch information
sandersn authored and mprobst committed Jan 10, 2022
1 parent 67f9895 commit eb28e20
Show file tree
Hide file tree
Showing 6 changed files with 477 additions and 207 deletions.
12 changes: 12 additions & 0 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,14 @@ namespace ts {
// grammar errors
Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
Diagnostics.A_get_accessor_cannot_have_parameters.code,
Expand All @@ -855,13 +857,21 @@ namespace ts {
Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
Diagnostics.An_export_declaration_cannot_have_modifiers.code,
Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
Diagnostics.An_import_declaration_cannot_have_modifiers.code,
Diagnostics.An_object_member_cannot_be_declared_optional.code,
Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
Diagnostics.Classes_can_only_extend_a_single_class.code,
Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
Diagnostics.Duplicate_label_0.code,
Expand All @@ -873,6 +883,7 @@ namespace ts {
Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
Diagnostics.Jump_target_cannot_cross_function_boundary.code,
Diagnostics.Line_terminator_not_permitted_before_arrow.code,
Diagnostics.Modifiers_cannot_appear_here.code,
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
Expand All @@ -897,6 +908,7 @@ namespace ts {
Diagnostics._0_modifier_must_precede_1_modifier.code,
Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
Diagnostics.const_declarations_must_be_initialized.code,
Diagnostics.extends_clause_already_seen.code,
Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
]);
Expand Down
Loading

0 comments on commit eb28e20

Please sign in to comment.