fix(es/parser): Make UnterminatedBlockComment stick to the EOF (#9366)

**Related issue:**

 - https://github.com/wooorm/markdown-rs/pull/120
This commit is contained in:
Donny/강동윤 2024-08-01 20:33:13 +09:00 committed by GitHub
parent 1d11d8dee9
commit 4f0fc6eb65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 14 additions and 18 deletions

View File

@ -0,0 +1,6 @@
---
swc_ecma_parser: patch
swc_core: patch
---
fix(es/parser): Make `UnterminatedBlockComment` stick to the EOF

View File

@ -290,7 +290,8 @@ impl<'a> Lexer<'a> {
self.bump();
}
let span = Span::new(start, self.input.end_pos());
let end = self.input.end_pos();
let span = Span::new(end, end);
self.emit_error_span(span, SyntaxError::UnterminatedBlockComment)
}

View File

@ -1,6 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/025560435ed0b9a6.js:1:1]
1 | ,-> /*
2 | |
3 | `->
,-[$DIR/tests/test262-parser/fail/025560435ed0b9a6.js:3:2]
3 |
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/100c329e6dd70e5a.js:1:1]
1 | /*
: ^^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/1c6ba8177a9624f0.js:1:1]
,-[$DIR/tests/test262-parser/fail/1c6ba8177a9624f0.js:1:5]
1 | /*
: ^^^
`----

View File

@ -1,6 +1,5 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/65a7e95d594ad7ad.js:1:1]
1 | ,-> /*
2 | |
3 | `-> *
,-[$DIR/tests/test262-parser/fail/65a7e95d594ad7ad.js:3:1]
2 |
3 | *
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/766e0153d3f7ec95.js:1:1]
1 | /*
: ^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/86308fd40fa95e9d.js:1:1]
1 | /*hello
: ^^^^^^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/8d64a30d9de151b6.js:1:1]
1 | /**
: ^^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/ac1ee2739ad30d66.js:1:1]
0 | /*
: ^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/d056300d8658429f.js:1:1]
1 | /*
: ^^^
`----

View File

@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/e2cdddda85e8ffe1.js:1:1]
1 | /*hello *
: ^^^^^^^^^^
`----