fix(common): Fix column positions in generated sourcemaps (#1470)

Co-authored-by: 강동윤 <kdy1@dudy.kr>
This commit is contained in:
Devon Govett 2021-03-16 02:18:12 -04:00 committed by GitHub
parent a90368372f
commit 9d53a70221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_common"
repository = "https://github.com/swc-project/swc.git"
version = "0.10.12"
version = "0.10.13"
[features]
concurrent = ["parking_lot"]

View File

@ -1061,8 +1061,9 @@ impl SourceMap {
pos,
linebpos,
);
let chpos = { self.calc_extra_bytes(&f, &mut ch_start, pos) };
let linechpos = { self.calc_extra_bytes(&f, &mut line_ch_start, linebpos) };
let chpos = pos.to_u32() - self.calc_extra_bytes(&f, &mut ch_start, pos);
let linechpos =
linebpos.to_u32() - self.calc_extra_bytes(&f, &mut line_ch_start, linebpos);
let mut col = max(chpos, linechpos) - min(chpos, linechpos);