mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-29 20:51:37 +00:00
Only generate JS null checks in debug mode
In non-debug mode Rust is already checking these pointers, so let's only generate the relevant code in debug mode.
This commit is contained in:
@ -5,14 +5,16 @@ const useMoved = () => {
|
||||
const apple = new wasm.Fruit('apple');
|
||||
apple.name();
|
||||
wasm.eat(apple);
|
||||
assert.throws(() => apple.name(), /Attempt to use a moved value/);
|
||||
assert.throws(() => apple.name(),
|
||||
/Attempt to use a moved value|null pointer passed to rust/);
|
||||
};
|
||||
|
||||
const moveMoved = () => {
|
||||
const pear = new wasm.Fruit('pear');
|
||||
pear.name();
|
||||
wasm.eat(pear);
|
||||
assert.throws(() => wasm.eat(pear), /Attempt to use a moved value/);
|
||||
assert.throws(() => wasm.eat(pear),
|
||||
/Attempt to use a moved value|null pointer passed to rust/);
|
||||
};
|
||||
|
||||
exports.js_works = () => {
|
||||
|
Reference in New Issue
Block a user