wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Cannot import statics with the same name from different snippets.

Open zopsicle opened this issue 1 year ago • 0 comments

Describe the Bug

Cannot import statics with the same name from different snippets.

Steps to Reproduce

mod a
{
    use super::*;

    #[wasm_bindgen(inline_js = r#"export const X = 1;"#)]
    extern
    {
        pub static X: JsValue;
    }
}

mod b
{
    use super::*;

    #[wasm_bindgen(inline_js = r#"export const X = 2;"#)]
    extern
    {
        pub static X: JsValue;
    }
}

#[wasm_bindgen(inline_js = r#"export function f(a, b) { console.log(a, b); }"#)]
extern
{
    fn f(a: &JsValue, b: &JsValue);
}

#[wasm_bindgen(start)]
pub fn g()
{
    f(&a::X, &b::X)
}

Expected Behavior

Output is [1, 2].

Actual Behavior

Output is [1, 1].

Additional Context

Using wasm-bindgen 0.2.92.

zopsicle avatar Mar 09 '24 21:03 zopsicle