aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 3a955b4c6dd..1ac3b102574 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2245,8 +2245,6 @@ class CGConstructorEnabled(CGAbstractMethod):
unsafe_fn=True)
def definition_body(self):
- body = CGList([], "\n")
-
conditions = []
iface = self.descriptor.interface
@@ -2254,25 +2252,15 @@ class CGConstructorEnabled(CGAbstractMethod):
if pref:
assert isinstance(pref, list) and len(pref) == 1
conditions.append('PREFS.get("%s").as_boolean().unwrap_or(false)' % pref[0])
+
func = iface.getExtendedAttribute("Func")
if func:
assert isinstance(func, list) and len(func) == 1
conditions.append("%s(aCx, aObj)" % func[0])
- # We should really have some conditions
- assert len(body) or len(conditions)
-
- conditionsWrapper = ""
- if len(conditions):
- conditionsWrapper = CGWrapper(CGList((CGGeneric(cond) for cond in conditions),
- " &&\n"),
- pre="return ",
- post=";\n",
- reindent=True)
- else:
- conditionsWrapper = CGGeneric("return true;\n")
- body.append(conditionsWrapper)
- return body
+ assert conditions
+
+ return CGList((CGGeneric(cond) for cond in conditions), " &&\n")
def CreateBindingJSObject(descriptor, parent=None):