Cleanups for future script crate split (#35987)

* script: Avoid direct impl blocks on generated dicts and unions.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Remove references to codegen-specific import module.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix tidy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-03-16 09:46:14 -04:00 committed by GitHub
parent 3ecd1c0699
commit d35da38a2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 211 additions and 146 deletions

View file

@ -7,7 +7,8 @@ use js::rust::HandleObject;
use servo_media::audio::channel_node::ChannelNodeOptions;
use servo_media::audio::node::AudioNodeInit;
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use crate::conversions::Convert;
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT};
use crate::dom::baseaudiocontext::BaseAudioContext;
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelInterpretation,
@ -47,12 +48,13 @@ impl ChannelMergerNode {
return Err(Error::IndexSize);
}
let num_inputs = options.numberOfInputs;
let node = AudioNode::new_inherited(
AudioNodeInit::ChannelMergerNode(options.into()),
AudioNodeInit::ChannelMergerNode(options.convert()),
context,
node_options,
options.numberOfInputs, // inputs
1, // outputs
num_inputs, // inputs
1, // outputs
)?;
Ok(ChannelMergerNode { node })
}
@ -97,10 +99,10 @@ impl ChannelMergerNodeMethods<crate::DomTypeHolder> for ChannelMergerNode {
}
}
impl<'a> From<&'a ChannelMergerOptions> for ChannelNodeOptions {
fn from(options: &'a ChannelMergerOptions) -> Self {
Self {
channels: options.numberOfInputs as u8,
impl Convert<ChannelNodeOptions> for ChannelMergerOptions {
fn convert(self) -> ChannelNodeOptions {
ChannelNodeOptions {
channels: self.numberOfInputs as u8,
}
}
}