mirror of
https://github.com/swc-project/swc.git
synced 2024-11-22 15:25:01 +03:00
fix(es/parser): Fix span for unterminated block comments (#9361)
**Related issue:** - https://github.com/wooorm/mdxjs-rs/pull/49
This commit is contained in:
parent
9cd51cebdf
commit
dc1b87e43e
6
.changeset/large-glasses-move.md
Normal file
6
.changeset/large-glasses-move.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
swc_common: patch
|
||||
swc_ecma_parser: patch
|
||||
---
|
||||
|
||||
fix(es/parser): Fix span for unterminated block comments
|
@ -49,6 +49,14 @@ impl<'a> StringInput<'a> {
|
||||
self.reset_to(self.last_pos + BytePos(n as u32));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_pos(&self) -> BytePos {
|
||||
self.orig_start
|
||||
}
|
||||
|
||||
pub fn end_pos(&self) -> BytePos {
|
||||
self.last_pos
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates an [Input] from [SourceFile]. This is an alias for
|
||||
|
@ -290,7 +290,8 @@ impl<'a> Lexer<'a> {
|
||||
self.bump();
|
||||
}
|
||||
|
||||
self.emit_error(start, SyntaxError::UnterminatedBlockComment)
|
||||
let span = Span::new(start, self.input.end_pos());
|
||||
self.emit_error_span(span, SyntaxError::UnterminatedBlockComment)
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
|
Loading…
Reference in New Issue
Block a user