summaryrefslogtreecommitdiff
path: root/cli/compilers/ts.rs
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2020-03-24 20:55:54 -0700
committerGitHub <noreply@github.com>2020-03-24 23:55:54 -0400
commit3938071e91e7c3dcf7b4e727601e1e99005aceab (patch)
treecb028150a1850bb96b898f24f7f59f6c41318af0 /cli/compilers/ts.rs
parenteeedb416c098c50a05292cbbd8135b7050a5ce0e (diff)
errors: replace .lines with explicit .split newline (#4483)
Diffstat (limited to 'cli/compilers/ts.rs')
-rw-r--r--cli/compilers/ts.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs
index 4f822dc2c..a74e4a096 100644
--- a/cli/compilers/ts.rs
+++ b/cli/compilers/ts.rs
@@ -553,7 +553,9 @@ impl SourceMapGetter for TsCompiler {
.try_resolve_and_get_source_file(script_name)
.and_then(|out| {
str::from_utf8(&out.source_code).ok().and_then(|v| {
- let lines: Vec<&str> = v.lines().collect();
+ // Do NOT use .lines(): it skips the terminating empty line.
+ // (due to internally using .split_terminator() instead of .split())
+ let lines: Vec<&str> = v.split('\n').collect();
assert!(lines.len() > line);
Some(lines[line].to_string())
})