Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static_method_of shows unexpected behavior #2040

Open
anlumo opened this issue Mar 13, 2020 · 0 comments · May be fixed by #2124
Open

static_method_of shows unexpected behavior #2040

anlumo opened this issue Mar 13, 2020 · 0 comments · May be fixed by #2124
Labels

Comments

@anlumo
Copy link

anlumo commented Mar 13, 2020

Describe the Bug

Take this code:

#[wasm_bindgen(module = "my-great-module")]
extern "C" {
    #[wasm_bindgen(js_name = default)]
    pub type Module;

    #[wasm_bindgen(static_method_of = Module)]
    pub fn init();
}

Expected Behavior

Generated index.js:

import { default as default1 } from 'my-great-module';

Actual Behavior

import { Module } from 'my-great-module';

Additional Context

The problem is that static_method_of binds to the type name given instead of the js_name defined for that type. static_method_of = default also doesn't work, because the type default is not known.

This produces the expected behavior:

#[wasm_bindgen(module = "my-great-module")]
extern "C" {
    #[wasm_bindgen(js_name = default)]
    pub type Module;

    #[wasm_bindgen(static_method_of = Module, js_class = "default")]
    pub fn init();
}

but this double specification shouldn't be necessary.

@anlumo anlumo added the bug label Mar 13, 2020
@a1trl9 a1trl9 linked a pull request May 6, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant