mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-22 12:42:14 +00:00
Generate const mixin bindings
Whenever an interface includes a mixin which includes consts, inline the consts onto the interface.
This commit is contained in:
parent
dca53550b8
commit
dce4a88f7d
@ -48,4 +48,5 @@ fn floats() {
|
|||||||
assert!(ConstDoubles::INF.is_infinite());
|
assert!(ConstDoubles::INF.is_infinite());
|
||||||
assert!(ConstDoubles::INF.is_sign_positive());
|
assert!(ConstDoubles::INF.is_sign_positive());
|
||||||
assert!(ConstDoubles::NAN.is_nan());
|
assert!(ConstDoubles::NAN.is_nan());
|
||||||
|
assert_eq!(ConstDoubles::ONE, 1.0);
|
||||||
}
|
}
|
||||||
|
6
crates/webidl-tests/consts.webidl
vendored
6
crates/webidl-tests/consts.webidl
vendored
@ -44,3 +44,9 @@ interface ConstDoubles {
|
|||||||
const unrestricted double inf = Infinity;
|
const unrestricted double inf = Infinity;
|
||||||
const unrestricted double nan = NaN;
|
const unrestricted double nan = NaN;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface mixin ConstDoublesMixin {
|
||||||
|
const double one = 1.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
ConstDoubles includes ConstDoublesMixin;
|
||||||
|
@ -477,9 +477,11 @@ impl<'a, 'src> WebidlParse<'src, &'a str> for weedle::mixin::MixinMember<'src> {
|
|||||||
weedle::mixin::MixinMember::Operation(op) => {
|
weedle::mixin::MixinMember::Operation(op) => {
|
||||||
op.webidl_parse(program, first_pass, self_name)
|
op.webidl_parse(program, first_pass, self_name)
|
||||||
}
|
}
|
||||||
|
weedle::mixin::MixinMember::Const(const_) => {
|
||||||
|
const_.webidl_parse(program, first_pass, self_name)
|
||||||
|
}
|
||||||
// TODO
|
// TODO
|
||||||
weedle::mixin::MixinMember::Stringifier(_) |
|
weedle::mixin::MixinMember::Stringifier(_) => {
|
||||||
weedle::mixin::MixinMember::Const(_) => {
|
|
||||||
warn!("Unsupported WebIDL mixin member: {:?}", self);
|
warn!("Unsupported WebIDL mixin member: {:?}", self);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user