New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(common): Mark \r
as a line ending
#6752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_common
@@ -47,167 +48,6 @@ pub fn analyze_source_file( | |||
(lines, multi_byte_chars, non_narrow_chars) | |||
} | |||
|
|||
cfg_if::cfg_if! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal, but I'm not sure if this optimization is really required.
@@ -240,6 +80,14 @@ fn analyze_source_file_generic( | |||
let pos = BytePos::from_usize(i) + output_offset; | |||
|
|||
match byte { | |||
b'\r' => { | |||
lines.push(pos + BytePos(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this need to be + BytePos(2)
if we're hitting a \r\n
?
crates/swc/tests/source_map.rs
Outdated
let source_map = sourcemap::SourceMap::from_slice(map.as_bytes()) | ||
.expect("failed to deserialize sourcemap"); | ||
|
||
dbg!(&source_map); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the debug and prints supposed to still be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
Description:
Related issue: