mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
fix(es/parser): Fix infinite loop on jsx in js (#7191)
This commit is contained in:
parent
48843455fa
commit
414e66910d
@ -845,6 +845,10 @@ impl<'a, I: Tokens> Parser<I> {
|
||||
|
||||
while !eat!(self, ';') {
|
||||
bump!(self);
|
||||
|
||||
if let Some(Token::Error(_)) = self.input.cur() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
5
crates/swc_ecma_parser/tests/errors/jsx_in_js/input.js
Normal file
5
crates/swc_ecma_parser/tests/errors/jsx_in_js/input.js
Normal file
@ -0,0 +1,5 @@
|
||||
const a = (
|
||||
<section>
|
||||
<a href="/foo">foo</a>
|
||||
</section>
|
||||
);
|
@ -0,0 +1,32 @@
|
||||
|
||||
x Unterminated regexp literal
|
||||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1]
|
||||
2 | <section>
|
||||
3 | <a href="/foo">foo</a>
|
||||
: ^^^
|
||||
4 | </section>
|
||||
`----
|
||||
|
||||
x Expression expected
|
||||
,-[$DIR/tests/errors/jsx_in_js/input.js:1:1]
|
||||
1 | const a = (
|
||||
2 | <section>
|
||||
: ^
|
||||
3 | <a href="/foo">foo</a>
|
||||
`----
|
||||
|
||||
x Expression expected
|
||||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1]
|
||||
2 | <section>
|
||||
3 | <a href="/foo">foo</a>
|
||||
: ^
|
||||
4 | </section>
|
||||
`----
|
||||
|
||||
x Expected a semicolon
|
||||
,-[$DIR/tests/errors/jsx_in_js/input.js:2:1]
|
||||
2 | <section>
|
||||
3 | <a href="/foo">foo</a>
|
||||
: ^^^^
|
||||
4 | </section>
|
||||
`----
|
Loading…
Reference in New Issue
Block a user