-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cannot import and export function of the same name #1496
Comments
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
May 1, 2019
Run exports through the same identifier generation as imports to ensure that everything gets a unique identifier and then just make sure all the appropriate wires are hooked up when dealing with exports and imports. Closes rustwasm#1496
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
May 3, 2019
Run exports through the same identifier generation as imports to ensure that everything gets a unique identifier and then just make sure all the appropriate wires are hooked up when dealing with exports and imports. Closes rustwasm#1496
@alexcrichton - This is now giving an error: #[wasm_bindgen]
#[derive(Copy, Clone)]
pub enum ImageFormat {
PNG,
JPEG,
GIF,
}
#[wasm_bindgen]
impl ImageFormat {
#[wasm_bindgen]
pub fn from_str(s: &str) -> Result<ImageFormat, JsValue> {
match s {
"PNG" => Ok(ImageFormat::PNG),
"JPEG" => Ok(ImageFormat::JPEG),
"GIF" => Ok(ImageFormat::GIF),
_ => Err(JsValue::from(js_sys::Error::new(&format!("Unknown format: {}", s)))),
}
}
} The error is
Is this a bug in generating a static method? Should I open a new issue? Am I doing something wrong? |
@cretz hm that looks like it may be unrelated to this, mind opening a new issue for that? |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Currently this generates invalid JS:
as it looks like:
but that imports the name
foo
and also exports it!The text was updated successfully, but these errors were encountered: