mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
fix(coverage): Error if the emit cache is invalid (#16850)
This commit is contained in:
parent
e4fe5ee72a
commit
2656af2544
7 changed files with 101 additions and 23 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue