summaryrefslogtreecommitdiff
path: root/cli/cache
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cache')
-rw-r--r--cli/cache/parsed_source.rs8
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 {