-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
getter
s, setter
s, and constructor
s compiler errors for enu…
…ms (#4278)
- Loading branch information
1 parent
af7c106
commit 83a2ff4
Showing
16 changed files
with
406 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct RustStruct { | ||
data: u32, | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl RustStruct { | ||
pub fn instance_method(&self) {} | ||
fn priv_instance_method(&self) {} | ||
pub fn static_method() {} | ||
|
||
#[wasm_bindgen(constructor)] | ||
pub fn new() -> Self { | ||
Self { data: 0 } | ||
} | ||
|
||
#[wasm_bindgen(getter)] | ||
pub fn prop(self) -> u32 { | ||
32 | ||
} | ||
#[wasm_bindgen(setter)] | ||
pub fn set_prop(self, _value: u32) {} | ||
|
||
#[wasm_bindgen(getter)] | ||
pub fn static_prop() -> u32 { | ||
32 | ||
} | ||
#[wasm_bindgen(setter)] | ||
pub fn set_static_prop(_value: u32) {} | ||
|
||
#[wasm_bindgen(indexing_getter)] | ||
pub fn indexing_getter(self) -> u32 { | ||
32 | ||
} | ||
#[wasm_bindgen(indexing_setter)] | ||
pub fn indexing_setter(self, _value: u32) {} | ||
#[wasm_bindgen(indexing_deleter)] | ||
pub fn indexing_deleter(self, _value: u32) {} | ||
} | ||
|
||
#[wasm_bindgen] | ||
pub enum RustEnum { | ||
A = 0, | ||
B = 1, | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl RustEnum { | ||
pub fn instance_method(self) {} | ||
fn priv_instance_method(self) {} | ||
pub fn static_method() {} | ||
|
||
#[wasm_bindgen(constructor)] | ||
pub fn new() -> Self { | ||
Self::A | ||
} | ||
|
||
#[wasm_bindgen(getter)] | ||
pub fn prop(self) -> u32 { | ||
32 | ||
} | ||
#[wasm_bindgen(setter)] | ||
pub fn set_prop(self, _value: u32) {} | ||
|
||
#[wasm_bindgen(getter)] | ||
pub fn static_prop() -> u32 { | ||
32 | ||
} | ||
#[wasm_bindgen(setter)] | ||
pub fn set_static_prop(_value: u32) {} | ||
} | ||
|
||
pub struct NonWasmType; | ||
|
||
#[wasm_bindgen] | ||
impl NonWasmType { | ||
pub fn static_method() {} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.