diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-08-06 10:36:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 10:36:16 -0400 |
commit | 466d3df9d1ff43e16e1a2c20b7792de664547b48 (patch) | |
tree | 170b2ab1097331d976ccee47671964b2ebdcc974 /cli/module_graph.rs | |
parent | e9ddc7a41ad7ea02172d88e95c82d007d8d5df63 (diff) |
refactor: make `ParsedModule` implement `Sync` (#11581)
Diffstat (limited to 'cli/module_graph.rs')
-rw-r--r-- | cli/module_graph.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 1a82bce0e..26c20f21d 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -349,7 +349,7 @@ impl Module { // parse out any triple slash references for comment in parsed_module.get_leading_comments().iter() { if let Some((ts_reference, _)) = parse_ts_reference(comment) { - let location = parsed_module.get_location(&comment.span); + let location = parsed_module.get_location(comment.span.lo); match ts_reference { TypeScriptReference::Path(import) => { let specifier = @@ -386,12 +386,7 @@ impl Module { for desc in dependencies.iter().filter(|desc| { desc.kind != swc_ecmascript::dep_graph::DependencyKind::Require }) { - let loc = parsed_module.source_map.lookup_char_pos(desc.span.lo); - let location = Location { - filename: self.specifier.to_string(), - col: loc.col_display, - line: loc.line, - }; + let location = parsed_module.get_location(desc.span.lo); // In situations where there is a potential issue with resolving the // import specifier, that ends up being a module resolution error for a @@ -468,7 +463,7 @@ impl Module { let referrer_scheme = self.specifier.scheme(); let specifier_scheme = specifier.scheme(); let location = maybe_location.unwrap_or(Location { - filename: self.specifier.to_string(), + specifier: self.specifier.to_string(), line: 0, col: 0, }); |