File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2482,9 +2482,9 @@ class parser {
24822482 bool parsed_body =
24832483 this ->parse_and_visit_statement_disallowing_declaration (v);
24842484 if (!parsed_body) {
2485+ const char8 *here = this ->lexer_ .end_of_previous_token ();
24852486 this ->error_reporter_ ->report (error_missing_body_for_for_statement{
2486- .for_and_header = source_code_span (
2487- for_token_span.begin (), this ->lexer_ .end_of_previous_token ()),
2487+ .for_and_header = source_code_span (here, here),
24882488 });
24892489 }
24902490
Original file line number Diff line number Diff line change @@ -918,10 +918,11 @@ TEST(test_parse, for_loop_without_body) {
918918 " visit_variable_use" , // myArray
919919 " visit_variable_declaration" , // x
920920 " visit_exit_for_scope" ));
921- EXPECT_THAT (v.errors ,
922- ElementsAre (ERROR_TYPE_FIELD (
923- error_missing_body_for_for_statement, for_and_header,
924- offsets_matcher (&code, 0 , u8" for (let x of myArray)" ))));
921+ EXPECT_THAT (
922+ v.errors ,
923+ ElementsAre (ERROR_TYPE_FIELD (
924+ error_missing_body_for_for_statement, for_and_header,
925+ offsets_matcher (&code, strlen (u8" for (let x of myArray)" ), u8" " ))));
925926 }
926927
927928 {
@@ -938,8 +939,8 @@ TEST(test_parse, for_loop_without_body) {
938939 EXPECT_THAT (v.errors ,
939940 ElementsAre (ERROR_TYPE_FIELD (
940941 error_missing_body_for_for_statement, for_and_header,
941- offsets_matcher (&code, strlen (u8" { " ),
942- u8" for (let x of myArray) " ))));
942+ offsets_matcher (&code, strlen (u8" { for (let x of myArray) " ),
943+ u8" " ))));
943944 }
944945}
945946
You can’t perform that action at this time.
0 commit comments