Skip to content

Commit 8594cae

Browse files
authored
Use standard memory name for the export (#2583)
Fixes #2114.
1 parent e8bf537 commit 8594cae

File tree

1 file changed

+6
-3
lines changed
  • crates/cli-support/src/js

1 file changed

+6
-3
lines changed

crates/cli-support/src/js/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,13 +1754,13 @@ impl<'a> Context<'a> {
17541754
let add = self.expose_add_to_externref_table(table, alloc)?;
17551755
self.global(&format!(
17561756
"\
1757-
function handleError(f, args) {{
1757+
function handleError(f, args) {{
17581758
try {{
17591759
return f.apply(this, args);
17601760
}} catch (e) {{
17611761
const idx = {}(e);
17621762
wasm.{}(idx);
1763-
}}
1763+
}}
17641764
}}
17651765
",
17661766
add, store,
@@ -1791,7 +1791,7 @@ impl<'a> Context<'a> {
17911791
}
17921792
self.global(
17931793
"\
1794-
function logError(f, args) {
1794+
function logError(f, args) {
17951795
try {
17961796
return f.apply(this, args);
17971797
} catch (e) {
@@ -3306,6 +3306,9 @@ impl<'a> Context<'a> {
33063306
let default_name = format!("__wbindgen_export_{}", self.next_export_idx);
33073307
self.next_export_idx += 1;
33083308
let name = match id {
3309+
walrus::ExportItem::Memory(_) if self.module.memories.iter().count() == 1 => {
3310+
"memory".to_owned()
3311+
}
33093312
walrus::ExportItem::Function(f) => match &self.module.funcs.get(f).name {
33103313
Some(s) => to_js_identifier(s),
33113314
None => default_name,

0 commit comments

Comments
 (0)