diff options
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 3b35999cb65..c399b80fb09 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -4,13 +4,20 @@ # Common codegen classes. +import operator import os +import re import string -import operator -import itertools -from WebIDL import * -from Configuration import getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, Descriptor +from WebIDL import ( + BuiltinTypes, + IDLBuiltinType, + IDLNullValue, + IDLType, + IDLUndefinedValue, +) + +from Configuration import getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback AUTOGENERATED_WARNING_COMMENT = \ "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n" @@ -2103,12 +2110,6 @@ def needCx(returnType, arguments, extendedAttributes, considerTypes): (typeNeedsCx(returnType, True) or any(typeNeedsCx(a.type) for a in arguments))) -def needScopeObject(returnType, arguments, extendedAttributes, - isWrapperCached, considerTypes): - return (considerTypes and not isWrapperCached and - (typeNeedsScopeObject(returnType, True) or - any(typeNeedsScopeObject(a.type) for a in arguments))) - class CGCallGenerator(CGThing): """ A class to generate an actual call to a C++ object. Assumes that the C++ @@ -4579,10 +4580,6 @@ class CGNativeMember(ClassMethod): if needCx(returnType, argList, self.extendedAttrs, self.passJSBitsAsNeeded): args.insert(0, Argument("JSContext*", "cx")) - if needScopeObject(returnType, argList, self.extendedAttrs, - self.descriptorProvider, - self.passJSBitsAsNeeded): - args.insert(1, Argument("JS::Handle<JSObject*>", "obj")) # And if we're static, a global if self.member.isStatic(): args.insert(0, Argument("const GlobalObject&", "global")) @@ -4731,18 +4728,12 @@ class CGNativeMember(ClassMethod): return Argument(decl.define(), arg.identifier.name) -def isJSImplementedDescriptor(descriptorProvider): - return (isinstance(descriptorProvider, Descriptor) and - descriptorProvider.interface.isJSImplemented()) - class CGCallback(CGClass): def __init__(self, idlObject, descriptorProvider, baseName, methods, getters=[], setters=[]): self.baseName = baseName self._deps = idlObject.getDeps() name = idlObject.identifier.name - if isJSImplementedDescriptor(descriptorProvider): - name = jsImplName(name) # For our public methods that needThisHandling we want most of the # same args and the same return type as what CallbackMember # generates. So we want to take advantage of all its @@ -4884,11 +4875,7 @@ class CGCallbackInterface(CGCallback): if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()] methods = [CallbackOperation(m, sig, descriptor) for m in methods for sig in m.signatures()] - if iface.isJSImplemented() and iface.ctor(): - sigs = descriptor.interface.ctor().signatures() - if len(sigs) != 1: - raise TypeError("We only handle one constructor. See bug 869268.") - methods.append(CGJSImplInitOperation(sigs[0], descriptor)) + assert not iface.isJSImplemented() or not iface.ctor() CGCallback.__init__(self, iface, descriptor, "CallbackInterface", methods, getters=getters, setters=setters) @@ -4983,15 +4970,11 @@ class CallbackMember(CGNativeMember): "declName": "rvalDecl", } - if isJSImplementedDescriptor(self.descriptorProvider): - isCallbackReturnValue = "JSImpl" - else: - isCallbackReturnValue = "Callback" template, _, declType, needsRooting = getJSToNativeConversionTemplate( self.retvalType, self.descriptorProvider, exceptionCode=self.exceptionCode, - isCallbackReturnValue=isCallbackReturnValue, + isCallbackReturnValue="Callback", # XXXbz we should try to do better here sourceDescription="return value") |