mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-16 06:21:22 +00:00
Scope snippets within a crate
Use the same crate identifier for manually included snippets as well as inline snippets to help with debugging.
This commit is contained in:
@ -78,7 +78,7 @@ impl Interner {
|
||||
|
||||
// Generate a unique ID which is somewhat readable as well, so mix in
|
||||
// the crate name, hash to make it unique, and then the original path.
|
||||
let new_identifier = format!("{}-{}{}", self.crate_name, ShortHash(0), id);
|
||||
let new_identifier = format!("{}{}", self.unique_crate_identifier(), id);
|
||||
let file = LocalFile {
|
||||
path,
|
||||
definition: span,
|
||||
@ -88,6 +88,10 @@ impl Interner {
|
||||
drop(files);
|
||||
self.resolve_import_module(id, span)
|
||||
}
|
||||
|
||||
fn unique_crate_identifier(&self) -> String {
|
||||
format!("{}-{}", self.crate_name, ShortHash(0))
|
||||
}
|
||||
}
|
||||
|
||||
fn shared_program<'a>(
|
||||
@ -139,6 +143,7 @@ fn shared_program<'a>(
|
||||
.iter()
|
||||
.map(|js| intern.intern_str(js))
|
||||
.collect(),
|
||||
unique_crate_identifier: intern.intern_str(&intern.unique_crate_identifier()),
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user