diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-07-08 15:27:09 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-07-12 13:06:54 +0200 |
commit | 4c31c8ac7b6205967b90e6bc30d473abaa1726d7 (patch) | |
tree | 867cf5109b92c20cd83124ad2cf1a013a2f86201 /components/script/dom/bindings/codegen | |
parent | 28630f5487b5f12fd93215f1fa87169227c72a8f (diff) | |
download | servo-4c31c8ac7b6205967b90e6bc30d473abaa1726d7.tar.gz servo-4c31c8ac7b6205967b90e6bc30d473abaa1726d7.zip |
Simplify CGConstructorEnabled.
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 20 |
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): |