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.py36
1 files changed, 7 insertions, 29 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index defa55affea..a7bdc6ce01d 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -462,8 +462,7 @@ class CGMethodCall(CGThing):
pickFirstSignature("%s.get().is_object() && is_array_like(cx, %s)" %
(distinguishingArg, distinguishingArg),
lambda s:
- (s[1][distinguishingIndex].type.isArray() or
- s[1][distinguishingIndex].type.isSequence() or
+ (s[1][distinguishingIndex].type.isSequence() or
s[1][distinguishingIndex].type.isObject()))
# Check for Date objects
@@ -537,9 +536,6 @@ def typeIsSequenceOrHasSequenceMember(type):
type = type.inner
if type.isSequence():
return True
- if type.isArray():
- elementType = type.inner
- return typeIsSequenceOrHasSequenceMember(elementType)
if type.isDictionary():
return dictionaryHasSequenceMember(type.inner)
if type.isUnion():
@@ -732,9 +728,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
assert not (isEnforceRange and isClamp) # These are mutually exclusive
- if type.isArray():
- raise TypeError("Can't handle array arguments yet")
-
if type.isSequence() or type.isMozMap():
innerInfo = getJSToNativeConversionInfo(innerContainerType(type),
descriptorProvider,
@@ -1309,7 +1302,7 @@ def typeNeedsCx(type, retVal=False):
return False
if type.nullable():
type = type.inner
- if type.isSequence() or type.isArray():
+ if type.isSequence():
type = type.inner
if type.isUnion():
return any(typeNeedsCx(t) for t in type.unroll().flatMemberTypes)
@@ -1612,7 +1605,7 @@ class MethodDefiner(PropertyDefiner):
"name": "forEach",
"methodInfo": False,
"selfHostedName": "ArrayForEach",
- "length": 0,
+ "length": 1,
"condition": PropertyDefiner.getControllingCondition(m,
descriptor)
})
@@ -2383,16 +2376,8 @@ class CGAbstractMethod(CGThing):
if self.catchPanic:
body = CGWrapper(CGIndenter(body),
- pre="let result = panic::catch_unwind(AssertUnwindSafe(|| {\n",
- post=("""}));
-match result {
- Ok(result) => result,
- Err(error) => {
- store_panic_result(error);
- return%s;
- }
-}
-""" % ("" if self.returnType == "void" else " false")))
+ pre="return wrap_panic(|| {\n",
+ post=("""}, %s);""" % ("()" if self.returnType == "void" else "false")))
return CGWrapper(CGIndenter(body),
pre=self.definition_prologue(),
@@ -3817,9 +3802,6 @@ class CGMemberJITInfo(CGThing):
if t.isVoid():
# No return, every time
return "JSVAL_TYPE_UNDEFINED"
- if t.isArray():
- # No idea yet
- assert False
if t.isSequence():
return "JSVAL_TYPE_OBJECT"
if t.isMozMap():
@@ -3895,9 +3877,6 @@ class CGMemberJITInfo(CGThing):
if t.nullable():
# Sometimes it might return null, sometimes not
return "JSJitInfo_ArgType::Null as i32 | %s" % CGMemberJITInfo.getJSArgType(t.inner)
- if t.isArray():
- # No idea yet
- assert False
if t.isSequence():
return "JSJitInfo_ArgType::Object as i32"
if t.isGeckoInterface():
@@ -4161,7 +4140,7 @@ class CGUnionConversionStruct(CGThing):
else:
interfaceObject = None
- arrayObjectMemberTypes = filter(lambda t: t.isArray() or t.isSequence(), memberTypes)
+ arrayObjectMemberTypes = filter(lambda t: t.isSequence(), memberTypes)
if len(arrayObjectMemberTypes) > 0:
assert len(arrayObjectMemberTypes) == 1
typeName = arrayObjectMemberTypes[0].name
@@ -5566,6 +5545,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::utils::resolve_global',
'dom::bindings::utils::set_dictionary_property',
'dom::bindings::utils::trace_global',
+ 'dom::bindings::utils::wrap_panic',
'dom::bindings::trace::JSTraceable',
'dom::bindings::trace::RootedTraceable',
'dom::bindings::callback::CallSetup',
@@ -5617,14 +5597,12 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'libc',
'util::prefs::PREFS',
'script_runtime::maybe_take_panic_result',
- 'script_runtime::store_panic_result',
'std::borrow::ToOwned',
'std::cmp',
'std::mem',
'std::num',
'std::os',
'std::panic',
- 'std::panic::AssertUnwindSafe',
'std::ptr',
'std::str',
'std::rc',