Skip to content

Commit

Permalink
fix(parser): fix asi error diagnostic pointing at invalid text causin…
Browse files Browse the repository at this point in the history
…g crash (#4163)
  • Loading branch information
Boshen committed Jul 10, 2024
1 parent 3ba7cfe commit a956d2e
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 263 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/snapshots/button_has_type.snap
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ source: crates/oxc_linter/src/tester.rs
× Expected a semicolon or an implicit semicolon after a statement, but found none
╭─[button_has_type.tsx:1:7]
1 │ button type/>
·
·
╰────
help: Try insert a semicolon here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,6 @@ source: crates/oxc_linter/src/tester.rs
× Expected a semicolon or an implicit semicolon after a statement, but found none
╭─[consistent_indexed_object_style.tsx:1:10]
1funcction foo(): Record<string, any> {}
·
·
╰────
help: Try insert a semicolon here
2 changes: 1 addition & 1 deletion crates/oxc_parser/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<'a> ParserImpl<'a> {
/// # Errors
pub(crate) fn asi(&mut self) -> Result<()> {
if !self.can_insert_semicolon() {
let span = Span::new(self.prev_token_end, self.cur_token().start);
let span = Span::new(self.prev_token_end, self.prev_token_end);
return Err(diagnostics::auto_semicolon_insertion(span));
}
if self.at(Kind::Semicolon) {
Expand Down
1 change: 1 addition & 0 deletions tasks/coverage/misc/fail/oxc-4111-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
funtransientction as longciiConÞr>ol(cde) {
Loading

0 comments on commit a956d2e

Please sign in to comment.