From 466d3df9d1ff43e16e1a2c20b7792de664547b48 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 6 Aug 2021 10:36:16 -0400 Subject: refactor: make `ParsedModule` implement `Sync` (#11581) --- cli/module_graph.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cli/module_graph.rs') 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, }); -- cgit v1.2.3