diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-08-29 14:24:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 14:24:10 -0400 |
commit | c3e48cba184f2f8aaf3d30196b674c8a7dd8449b (patch) | |
tree | 4001dc9a30abbcf370971931891c0cf59aba4a2d /cli/cache | |
parent | b62ef4d37bc1207abb2daed5e2568eb581f07aa2 (diff) |
fix(compile): panic when running with a populated dep analysis cache (#15672)
Closes #15612
Diffstat (limited to 'cli/cache')
-rw-r--r-- | cli/cache/parsed_source.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/cache/parsed_source.rs b/cli/cache/parsed_source.rs index b35a89a14..0c9fe5c97 100644 --- a/cli/cache/parsed_source.rs +++ b/cli/cache/parsed_source.rs @@ -88,7 +88,7 @@ impl ParsedSourceCache { source: Arc<str>, media_type: MediaType, ) -> deno_core::anyhow::Result<ParsedSource, deno_ast::Diagnostic> { - let parser = CapturingModuleParser::new(None, &self.sources); + let parser = self.as_capturing_parser(); // this will conditionally parse because it's using a CapturingModuleParser parser.parse_module(specifier, source, media_type) } @@ -124,6 +124,12 @@ impl ParsedSourceCache { } } } + + /// Creates a parser that will reuse a ParsedSource from the store + /// if it exists, or else parse. + pub fn as_capturing_parser(&self) -> CapturingModuleParser { + CapturingModuleParser::new(None, &self.sources) + } } struct ParsedSourceCacheModuleAnalyzer { |