diff options
author | Nikhil Shagrithaya <nikhilshagri@gmail.com> | 2016-08-10 23:49:43 +0530 |
---|---|---|
committer | Nikhil Shagrithaya <nikhilshagri@gmail.com> | 2016-11-01 00:25:26 +0530 |
commit | 51ef05bf3dce801be0eb3a777b5ade72e4ece3dd (patch) | |
tree | 7eae741cd5f4d0566cf2fc55f10c8341d30c6283 /components/script/dom/bindings/codegen | |
parent | 7e96f87565d3e06de977a2cc14034d434aded27f (diff) | |
download | servo-51ef05bf3dce801be0eb3a777b5ade72e4ece3dd.tar.gz servo-51ef05bf3dce801be0eb3a777b5ade72e4ece3dd.zip |
Implemented FileReader::readAsArrayBuffer
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 4c67f61af2d..b65d2e65cdb 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2237,6 +2237,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config): 'js::error::throw_type_error', 'js::jsapi::HandleValue', 'js::jsapi::JSContext', + 'js::jsapi::JSObject', 'js::jsapi::MutableHandleValue', 'js::jsval::JSVal', ] @@ -4047,6 +4048,9 @@ def getUnionTypeTemplateVars(type, descriptorProvider): elif type.isPrimitive(): name = type.name typeName = builtinNames[type.tag()] + elif type.isObject(): + name = type.name + typeName = "*mut JSObject" else: raise TypeError("Can't handle %s in unions yet" % type) @@ -4056,7 +4060,6 @@ def getUnionTypeTemplateVars(type, descriptorProvider): isDefinitelyObject=True) template = info.template - assert not type.isObject() jsConversion = string.Template(template).substitute({ "val": "value", }) @@ -4176,7 +4179,10 @@ class CGUnionConversionStruct(CGThing): objectMemberTypes = filter(lambda t: t.isObject(), memberTypes) if len(objectMemberTypes) > 0: - raise TypeError("Can't handle objects in unions.") + assert len(objectMemberTypes) == 1 + typeName = objectMemberTypes[0].name + object = CGGeneric(get_match(typeName)) + names.append(typeName) else: object = None @@ -4191,7 +4197,8 @@ class CGUnionConversionStruct(CGThing): hasObjectTypes = interfaceObject or arrayObject or dateObject or nonPlatformObject or object or mozMapObject if hasObjectTypes: - assert interfaceObject or arrayObject or mozMapObject + # "object" is not distinguishable from other types + assert not object or not (interfaceObject or arrayObject or dateObject or callbackObject or mozMapObject) templateBody = CGList([], "\n") if interfaceObject: templateBody.append(interfaceObject) |