Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Oct 4, 2024
1 parent ce640c6 commit 3a5b96e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions components/script_bindings/codegen/CodegenRust.py
Original file line number Diff line number Diff line change
Expand Up @@ -2874,7 +2874,7 @@ class CGAbstractMethod(CGThing):
"""
def __init__(self, descriptor, name, returnType, args, inline=False,
alwaysInline=False, extern=False, unsafe=False, pub=False,
templateArgs=None, docs=None, doesNotPanic=False):
templateArgs=None, docs=None, doesNotPanic=False, extra_decorators=[]):
CGThing.__init__(self)
self.descriptor = descriptor
self.name = name
Expand All @@ -2887,6 +2887,7 @@ def __init__(self, descriptor, name, returnType, args, inline=False,
self.pub = pub
self.docs = docs
self.catchPanic = self.extern and not doesNotPanic
self.extra_decorators = extra_decorators

def _argstring(self):
return ', '.join([a.declare() for a in self.args])
Expand All @@ -2908,6 +2909,8 @@ def _decorators(self):
if self.alwaysInline:
decorators.append('#[inline]')

decorators.extend(self.extra_decorators)

if self.pub:
decorators.append('pub')

Expand Down Expand Up @@ -3167,7 +3170,8 @@ def __init__(self, descriptor, properties):
Argument(f"Box<{descriptor.concreteType}>", 'object')]
retval = f'DomRoot<{descriptor.concreteType}>'
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
pub=True, unsafe=True, templateArgs=['D: DomTypes'])
pub=True, unsafe=True, templateArgs=['D: DomTypes'],
extra_decorators=['#[allow(crown::unrooted_must_root)]'])
self.properties = properties

def definition_body(self):
Expand Down Expand Up @@ -7692,6 +7696,7 @@ def __init__(self, idlObject, descriptorProvider, baseName, methods):
methods=realMethods,
templateSpecialization=['D: DomTypes'],
decorators="#[derive(JSTraceable, PartialEq)]\n"
"#[allow(crown::unrooted_must_root)]\n"
"#[crown::unrooted_must_root_lint::allow_unrooted_interior]")

def getConstructors(self):
Expand Down
2 changes: 1 addition & 1 deletion components/script_bindings/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! unsafe_no_jsmanaged_fields(
/// Generated JS-Rust bindings.
#[allow(missing_docs, non_snake_case)]
pub mod codegen {
#[allow(dead_code/*, crown::unrooted_must_root*/)]
#[allow(dead_code, crown::unrooted_must_root)]
pub mod Bindings {
include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
}
Expand Down

0 comments on commit 3a5b96e

Please sign in to comment.