summaryrefslogtreecommitdiff
path: root/cli/emit.rs
diff options
context:
space:
mode:
authorsigmaSd <bedisnbiba@gmail.com>2022-11-29 18:43:54 +0100
committerGitHub <noreply@github.com>2022-11-29 18:43:54 +0100
commit2656af2544cd1773e5b7d57e4306a8cec15ef887 (patch)
tree8e809cf8461162c0301f447c002120f2d379813a /cli/emit.rs
parente4fe5ee72ace30ccd1b7b6b15717164cf79f49c4 (diff)
fix(coverage): Error if the emit cache is invalid (#16850)
Diffstat (limited to 'cli/emit.rs')
-rw-r--r--cli/emit.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/cli/emit.rs b/cli/emit.rs
index 3bf56fae6..ee591b2a1 100644
--- a/cli/emit.rs
+++ b/cli/emit.rs
@@ -12,7 +12,7 @@ use std::sync::Arc;
/// A hashing function that takes the source code and emit options
/// hash then generates a string hash which can be stored to
/// determine if the cached emit is valid or not.
-fn get_source_hash(source_text: &str, emit_options_hash: u64) -> u64 {
+pub fn get_source_hash(source_text: &str, emit_options_hash: u64) -> u64 {
FastInsecureHasher::new()
.write_str(source_text)
.write_u64(emit_options_hash)
@@ -30,9 +30,7 @@ pub fn emit_parsed_source(
) -> Result<String, AnyError> {
let source_hash = get_source_hash(source, emit_config_hash);
- if let Some(emit_code) =
- emit_cache.get_emit_code(specifier, Some(source_hash))
- {
+ if let Some(emit_code) = emit_cache.get_emit_code(specifier, source_hash) {
Ok(emit_code)
} else {
// this will use a cached version if it exists