mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-29 04:31:33 +00:00
Fix codegen of consuming setters/getters (#2172)
Make sure they reset their internal pointer to null after we call Rust since it invalidates the Rust pointer after being called! Closes #2168
This commit is contained in:
@ -33,4 +33,11 @@ exports.js_works = () => {
|
||||
useMoved();
|
||||
moveMoved();
|
||||
methodMoved();
|
||||
|
||||
const a = new wasm.Fruit('a');
|
||||
a.prop;
|
||||
assertMovedPtrThrows(() => a.prop);
|
||||
const b = new wasm.Fruit('a');
|
||||
b.prop = 3;
|
||||
assertMovedPtrThrows(() => { b.prop = 4; });
|
||||
};
|
||||
|
@ -25,6 +25,14 @@ impl Fruit {
|
||||
pub fn rot(self) {
|
||||
drop(self);
|
||||
}
|
||||
|
||||
#[wasm_bindgen(getter)]
|
||||
pub fn prop(self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[wasm_bindgen(setter)]
|
||||
pub fn set_prop(self, _val: u32) {}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
|
Reference in New Issue
Block a user