Skip to content

Commit

Permalink
fix(es/parser): Make UnterminatedBlockComment stick to the EOF (#9366)
Browse files Browse the repository at this point in the history
**Related issue:**

 - wooorm/markdown-rs#120
  • Loading branch information
kdy1 authored Aug 1, 2024
1 parent 1d11d8d commit 4f0fc6e
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .changeset/thin-cobras-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_ecma_parser: patch
swc_core: patch
---

fix(es/parser): Make `UnterminatedBlockComment` stick to the EOF
3 changes: 2 additions & 1 deletion crates/swc_ecma_parser/src/lexer/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 |
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/100c329e6dd70e5a.js:1:1]
1 | /*

: ^^^
`----
Original file line number Diff line number Diff line change
@@ -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 | /*
: ^^^
`----
Original file line number Diff line number Diff line change
@@ -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 | *
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/766e0153d3f7ec95.js:1:1]
1 | /*
: ^^
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/86308fd40fa95e9d.js:1:1]
1 | /*hello
: ^^^^^^^
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/8d64a30d9de151b6.js:1:1]
1 | /**
: ^^^
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/ac1ee2739ad30d66.js:1:1]
0 | /*
: ^^
`----
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
x Unterminated block comment
,-[$DIR/tests/test262-parser/fail/d056300d8658429f.js:1:1]
1 | /*

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

0 comments on commit 4f0fc6e

Please sign in to comment.