Generate const mixin bindings

Whenever an interface includes a mixin which includes consts, inline the consts
onto the interface.
This commit is contained in:
Alex Crichton 2018-08-13 21:57:29 -07:00
parent dca53550b8
commit dce4a88f7d
3 changed files with 11 additions and 2 deletions

View File

@ -48,4 +48,5 @@ fn floats() {
assert!(ConstDoubles::INF.is_infinite());
assert!(ConstDoubles::INF.is_sign_positive());
assert!(ConstDoubles::NAN.is_nan());
assert_eq!(ConstDoubles::ONE, 1.0);
}

View File

@ -44,3 +44,9 @@ interface ConstDoubles {
const unrestricted double inf = Infinity;
const unrestricted double nan = NaN;
};
interface mixin ConstDoublesMixin {
const double one = 1.0;
};
ConstDoubles includes ConstDoublesMixin;

View File

@ -477,9 +477,11 @@ impl<'a, 'src> WebidlParse<'src, &'a str> for weedle::mixin::MixinMember<'src> {
weedle::mixin::MixinMember::Operation(op) => {
op.webidl_parse(program, first_pass, self_name)
}
weedle::mixin::MixinMember::Const(const_) => {
const_.webidl_parse(program, first_pass, self_name)
}
// TODO
weedle::mixin::MixinMember::Stringifier(_) |
weedle::mixin::MixinMember::Const(_) => {
weedle::mixin::MixinMember::Stringifier(_) => {
warn!("Unsupported WebIDL mixin member: {:?}", self);
Ok(())
}