script: Include constructors and static methods in generated DOM traits (#33665)

* Add all constructors, special operations, and static methods to generated DOM interface traits.

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

* Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls.

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

* Add missing doc links.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-10-07 21:51:58 -04:00 committed by GitHub
parent 946fa9cdee
commit 7d931e673a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
133 changed files with 1479 additions and 1438 deletions

View file

@ -79,8 +79,10 @@ impl TestBinding {
can_gc,
)
}
}
pub fn Constructor(
impl TestBindingMethods for TestBinding {
fn Constructor(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,
@ -89,7 +91,7 @@ impl TestBinding {
}
#[allow(unused_variables)]
pub fn Constructor_(
fn Constructor_(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,
@ -99,7 +101,7 @@ impl TestBinding {
}
#[allow(unused_variables)]
pub fn Constructor__(
fn Constructor__(
global: &GlobalScope,
proto: Option<HandleObject>,
can_gc: CanGc,
@ -107,9 +109,7 @@ impl TestBinding {
) -> Fallible<DomRoot<TestBinding>> {
Ok(TestBinding::new(global, proto, can_gc))
}
}
impl TestBindingMethods for TestBinding {
fn BooleanAttribute(&self) -> bool {
false
}
@ -1108,42 +1108,36 @@ impl TestBindingMethods for TestBinding {
fn MethodInternalThrowToRejectPromise(&self, _arg: u64) -> Rc<Promise> {
unreachable!("Method should already throw")
}
}
#[allow(non_snake_case)]
impl TestBinding {
pub fn StaticThrowToRejectPromise(_: &GlobalScope) -> Fallible<Rc<Promise>> {
fn StaticThrowToRejectPromise(_: &GlobalScope) -> Fallible<Rc<Promise>> {
Err(Error::Type("test".to_string()))
}
pub fn StaticInternalThrowToRejectPromise(_: &GlobalScope, _arg: u64) -> Rc<Promise> {
fn StaticInternalThrowToRejectPromise(_: &GlobalScope, _arg: u64) -> Rc<Promise> {
unreachable!("Method should already throw")
}
}
#[allow(non_snake_case)]
impl TestBinding {
pub fn BooleanAttributeStatic(_: &GlobalScope) -> bool {
fn BooleanAttributeStatic(_: &GlobalScope) -> bool {
false
}
pub fn SetBooleanAttributeStatic(_: &GlobalScope, _: bool) {}
pub fn ReceiveVoidStatic(_: &GlobalScope) {}
pub fn PrefControlledStaticAttributeDisabled(_: &GlobalScope) -> bool {
fn SetBooleanAttributeStatic(_: &GlobalScope, _: bool) {}
fn ReceiveVoidStatic(_: &GlobalScope) {}
fn PrefControlledStaticAttributeDisabled(_: &GlobalScope) -> bool {
false
}
pub fn PrefControlledStaticAttributeEnabled(_: &GlobalScope) -> bool {
fn PrefControlledStaticAttributeEnabled(_: &GlobalScope) -> bool {
false
}
pub fn PrefControlledStaticMethodDisabled(_: &GlobalScope) {}
pub fn PrefControlledStaticMethodEnabled(_: &GlobalScope) {}
pub fn FuncControlledStaticAttributeDisabled(_: &GlobalScope) -> bool {
fn PrefControlledStaticMethodDisabled(_: &GlobalScope) {}
fn PrefControlledStaticMethodEnabled(_: &GlobalScope) {}
fn FuncControlledStaticAttributeDisabled(_: &GlobalScope) -> bool {
false
}
pub fn FuncControlledStaticAttributeEnabled(_: &GlobalScope) -> bool {
fn FuncControlledStaticAttributeEnabled(_: &GlobalScope) -> bool {
false
}
pub fn FuncControlledStaticMethodDisabled(_: &GlobalScope) {}
pub fn FuncControlledStaticMethodEnabled(_: &GlobalScope) {}
fn FuncControlledStaticMethodDisabled(_: &GlobalScope) {}
fn FuncControlledStaticMethodEnabled(_: &GlobalScope) {}
}
impl TestBinding {