mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
fix(parser): fix panic on multi-byte char in ExpectCatchFinally error
This commit is contained in:
parent
e1546b87dd
commit
236d53ad9d
3 changed files with 6 additions and 7 deletions
|
|
@ -456,8 +456,8 @@ impl<'a> Parser<'a> {
|
|||
|
||||
let finalizer = self.eat(Kind::Finally).then(|| self.parse_block()).transpose()?;
|
||||
|
||||
let range = Span::new(self.prev_token_end, self.prev_token_end + 1);
|
||||
if handler.is_none() && finalizer.is_none() {
|
||||
let range = Span::new(block.span.end, block.span.end);
|
||||
self.error(diagnostics::ExpectCatchFinally(range));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8550,7 +8550,7 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
× Missing catch or finally clause
|
||||
╭─[esprima/invalid-syntax/migrated_0133/input.js:1:1]
|
||||
1 │ try { }
|
||||
· ─
|
||||
· ▲
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
|
|
|
|||
|
|
@ -21481,7 +21481,7 @@ Negative Passed: 3915/3915 (100.00%)
|
|||
╭─[language/statements/block/12.1-1.js:13:1]
|
||||
13 │
|
||||
14 │ try{};catch(){}
|
||||
· ─
|
||||
· ▲
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
|
|
@ -21495,7 +21495,7 @@ Negative Passed: 3915/3915 (100.00%)
|
|||
╭─[language/statements/block/12.1-2.js:15:1]
|
||||
15 │
|
||||
16 │ try{};catch{};finally{}
|
||||
· ─
|
||||
· ▲
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
|
|
@ -21509,7 +21509,7 @@ Negative Passed: 3915/3915 (100.00%)
|
|||
╭─[language/statements/block/12.1-3.js:13:1]
|
||||
13 │
|
||||
14 │ try{};finally{}
|
||||
· ─
|
||||
· ▲
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
|
|
@ -33589,9 +33589,8 @@ Negative Passed: 3915/3915 (100.00%)
|
|||
╭─[language/statements/try/S12.14_A16_T12.js:21:1]
|
||||
21 │ {
|
||||
22 │ }
|
||||
· ─
|
||||
· ▲
|
||||
23 │ }
|
||||
24 │ catch(e1){}
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
|
|
|
|||
Loading…
Reference in a new issue