forked from mirrors/gecko-dev
Bug 1885914 - Use __slots__ to speedup webidl parsing r=peterv
Per https://wiki.python.org/moin/UsingSlots, slots are more efficient in terms of memory space and speed of access Differential Revision: https://phabricator.services.mozilla.com/D204930
This commit is contained in:
parent
922cbe83d5
commit
4aad7fb908
1 changed files with 228 additions and 6 deletions
|
|
@ -121,6 +121,8 @@ class Location(object):
|
|||
|
||||
|
||||
class BuiltinLocation(object):
|
||||
__slots__ = "msg", "filename"
|
||||
|
||||
def __init__(self, text):
|
||||
self.msg = text + "\n"
|
||||
self.filename = "<builtin>"
|
||||
|
|
@ -142,9 +144,11 @@ class BuiltinLocation(object):
|
|||
|
||||
|
||||
class IDLObject(object):
|
||||
__slots__ = "location", "userData", "filename"
|
||||
|
||||
def __init__(self, location):
|
||||
self.location = location
|
||||
self.userData = dict()
|
||||
self.userData = {}
|
||||
self.filename = location and location.filename
|
||||
|
||||
def isInterface(self):
|
||||
|
|
@ -220,6 +224,8 @@ class IDLObject(object):
|
|||
|
||||
|
||||
class IDLScope(IDLObject):
|
||||
__slots__ = "parentScope", "_name", "_dict", "globalNames", "globalNameMapping"
|
||||
|
||||
def __init__(self, location, parentScope, identifier):
|
||||
IDLObject.__init__(self, location)
|
||||
|
||||
|
|
@ -349,6 +355,8 @@ class IDLScope(IDLObject):
|
|||
|
||||
|
||||
class IDLIdentifier(IDLObject):
|
||||
__slots__ = "name", "scope"
|
||||
|
||||
def __init__(self, location, scope, name):
|
||||
IDLObject.__init__(self, location)
|
||||
|
||||
|
|
@ -373,12 +381,14 @@ class IDLIdentifier(IDLObject):
|
|||
|
||||
|
||||
class IDLUnresolvedIdentifier(IDLObject):
|
||||
__slots__ = ("name",)
|
||||
|
||||
def __init__(
|
||||
self, location, name, allowDoubleUnderscore=False, allowForbidden=False
|
||||
):
|
||||
IDLObject.__init__(self, location)
|
||||
|
||||
assert len(name) > 0
|
||||
assert name
|
||||
|
||||
if name == "__noSuchMethod__":
|
||||
raise WebIDLError("__noSuchMethod__ is deprecated", [location])
|
||||
|
|
@ -417,6 +427,7 @@ class IDLUnresolvedIdentifier(IDLObject):
|
|||
|
||||
|
||||
class IDLObjectWithIdentifier(IDLObject):
|
||||
# no slots, incompatible with multiple inheritance
|
||||
def __init__(self, location, parentScope, identifier):
|
||||
IDLObject.__init__(self, location)
|
||||
|
||||
|
|
@ -434,6 +445,8 @@ class IDLObjectWithIdentifier(IDLObject):
|
|||
|
||||
|
||||
class IDLObjectWithScope(IDLObjectWithIdentifier, IDLScope):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, parentScope, identifier):
|
||||
assert isinstance(identifier, IDLUnresolvedIdentifier)
|
||||
|
||||
|
|
@ -442,6 +455,8 @@ class IDLObjectWithScope(IDLObjectWithIdentifier, IDLScope):
|
|||
|
||||
|
||||
class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, identifier):
|
||||
assert isinstance(identifier, IDLUnresolvedIdentifier)
|
||||
IDLObjectWithIdentifier.__init__(self, location, None, identifier)
|
||||
|
|
@ -459,6 +474,7 @@ class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
|
|||
|
||||
|
||||
class IDLExposureMixins:
|
||||
# no slots, incompatible with multiple inheritance
|
||||
def __init__(self, location):
|
||||
# _exposureGlobalNames are the global names listed in our [Exposed]
|
||||
# extended attribute. exposureSet is the exposure set as defined in the
|
||||
|
|
@ -541,6 +557,8 @@ class IDLExposureMixins:
|
|||
|
||||
|
||||
class IDLExternalInterface(IDLObjectWithIdentifier):
|
||||
__slots__ = ("parent",)
|
||||
|
||||
def __init__(self, location, parentScope, identifier):
|
||||
assert isinstance(identifier, IDLUnresolvedIdentifier)
|
||||
assert isinstance(parentScope, IDLScope)
|
||||
|
|
@ -591,6 +609,8 @@ class IDLExternalInterface(IDLObjectWithIdentifier):
|
|||
|
||||
|
||||
class IDLPartialDictionary(IDLObject):
|
||||
__slots__ = "identifier", "members", "_nonPartialDictionary", "_finished"
|
||||
|
||||
def __init__(self, location, name, members, nonPartialDictionary):
|
||||
assert isinstance(name, IDLUnresolvedIdentifier)
|
||||
|
||||
|
|
@ -619,6 +639,15 @@ class IDLPartialDictionary(IDLObject):
|
|||
|
||||
|
||||
class IDLPartialInterfaceOrNamespace(IDLObject):
|
||||
__slots__ = (
|
||||
"identifier",
|
||||
"members",
|
||||
"propagatedExtendedAttrs",
|
||||
"_haveSecureContextExtendedAttribute",
|
||||
"_nonPartialInterfaceOrNamespace",
|
||||
"_finished",
|
||||
)
|
||||
|
||||
def __init__(self, location, name, members, nonPartialInterfaceOrNamespace):
|
||||
assert isinstance(name, IDLUnresolvedIdentifier)
|
||||
|
||||
|
|
@ -726,12 +755,22 @@ def globalNameSetToExposureSet(globalScope, nameSet, exposureSet):
|
|||
# we use a special class to be able to store them both in the scope for the
|
||||
# same identifier.
|
||||
class IDLOperations:
|
||||
__slots__ = "static", "regular"
|
||||
|
||||
def __init__(self, static=None, regular=None):
|
||||
self.static = static
|
||||
self.regular = regular
|
||||
|
||||
|
||||
class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
||||
__slots__ = (
|
||||
"_finished",
|
||||
"members",
|
||||
"_partials",
|
||||
"_extendedAttrDict",
|
||||
"_isKnownNonPartial",
|
||||
)
|
||||
|
||||
def __init__(self, location, parentScope, name):
|
||||
assert isinstance(parentScope, IDLScope)
|
||||
assert isinstance(name, IDLUnresolvedIdentifier)
|
||||
|
|
@ -897,10 +936,12 @@ class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMix
|
|||
|
||||
|
||||
class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace):
|
||||
__slots__ = ("actualExposureGlobalNames",)
|
||||
|
||||
def __init__(self, location, parentScope, name, members, isKnownNonPartial):
|
||||
self.actualExposureGlobalNames = set()
|
||||
|
||||
assert isKnownNonPartial or len(members) == 0
|
||||
assert isKnownNonPartial or not members
|
||||
IDLInterfaceOrInterfaceMixinOrNamespace.__init__(
|
||||
self, location, parentScope, name
|
||||
)
|
||||
|
|
@ -1001,9 +1042,27 @@ class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace):
|
|||
|
||||
|
||||
class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
|
||||
__slots__ = (
|
||||
"parent",
|
||||
"_callback",
|
||||
"maplikeOrSetlikeOrIterable",
|
||||
"legacyFactoryFunctions",
|
||||
"legacyWindowAliases",
|
||||
"includedMixins",
|
||||
"interfacesBasedOnSelf",
|
||||
"_hasChildInterfaces",
|
||||
"_isOnGlobalProtoChain",
|
||||
"totalMembersInSlots",
|
||||
"_ownMembersInSlots",
|
||||
"iterableInterface",
|
||||
"asyncIterableInterface",
|
||||
"hasCrossOriginMembers",
|
||||
"hasDescendantWithCrossOriginMembers",
|
||||
)
|
||||
|
||||
def __init__(self, location, parentScope, name, parent, members, isKnownNonPartial):
|
||||
assert isKnownNonPartial or not parent
|
||||
assert isKnownNonPartial or len(members) == 0
|
||||
assert isKnownNonPartial or not members
|
||||
|
||||
self.parent = None
|
||||
self._callback = False
|
||||
|
|
@ -1011,13 +1070,13 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
|
|||
# legacyFactoryFunctions needs deterministic ordering because bindings code
|
||||
# outputs the constructs in the order that legacyFactoryFunctions enumerates
|
||||
# them.
|
||||
self.legacyFactoryFunctions = list()
|
||||
self.legacyFactoryFunctions = []
|
||||
self.legacyWindowAliases = []
|
||||
self.includedMixins = set()
|
||||
# self.interfacesBasedOnSelf is the set of interfaces that inherit from
|
||||
# self, including self itself.
|
||||
# Used for distinguishability checking.
|
||||
self.interfacesBasedOnSelf = set([self])
|
||||
self.interfacesBasedOnSelf = {self}
|
||||
self._hasChildInterfaces = False
|
||||
self._isOnGlobalProtoChain = False
|
||||
|
||||
|
|
@ -1885,6 +1944,8 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
|
|||
|
||||
|
||||
class IDLInterface(IDLInterfaceOrNamespace):
|
||||
__slots__ = ("classNameOverride",)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
location,
|
||||
|
|
@ -2103,6 +2164,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
|
||||
|
||||
class IDLNamespace(IDLInterfaceOrNamespace):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, parentScope, name, members, isKnownNonPartial):
|
||||
IDLInterfaceOrNamespace.__init__(
|
||||
self, location, parentScope, name, None, members, isKnownNonPartial
|
||||
|
|
@ -2161,6 +2224,16 @@ class IDLNamespace(IDLInterfaceOrNamespace):
|
|||
|
||||
|
||||
class IDLDictionary(IDLObjectWithScope):
|
||||
__slots__ = (
|
||||
"parent",
|
||||
"_finished",
|
||||
"members",
|
||||
"_partialDictionaries",
|
||||
"_extendedAttrDict",
|
||||
"needsConversionToJS",
|
||||
"needsConversionFromJS",
|
||||
)
|
||||
|
||||
def __init__(self, location, parentScope, name, parent, members):
|
||||
assert isinstance(parentScope, IDLScope)
|
||||
assert isinstance(name, IDLUnresolvedIdentifier)
|
||||
|
|
@ -2388,6 +2461,8 @@ class IDLDictionary(IDLObjectWithScope):
|
|||
|
||||
|
||||
class IDLEnum(IDLObjectWithIdentifier):
|
||||
__slots__ = ("_values",)
|
||||
|
||||
def __init__(self, location, parentScope, name, values):
|
||||
assert isinstance(parentScope, IDLScope)
|
||||
assert isinstance(name, IDLUnresolvedIdentifier)
|
||||
|
|
@ -2462,6 +2537,16 @@ class IDLType(IDLObject):
|
|||
"observablearray",
|
||||
)
|
||||
|
||||
__slots__ = (
|
||||
"name",
|
||||
"builtin",
|
||||
"legacyNullToEmptyString",
|
||||
"_clamp",
|
||||
"_enforceRange",
|
||||
"_allowShared",
|
||||
"_extendedAttrDict",
|
||||
)
|
||||
|
||||
def __init__(self, location, name):
|
||||
IDLObject.__init__(self, location)
|
||||
self.name = name
|
||||
|
|
@ -2662,6 +2747,8 @@ class IDLUnresolvedType(IDLType):
|
|||
Unresolved types are interface types
|
||||
"""
|
||||
|
||||
__slots__ = ("extraTypeAttributes",)
|
||||
|
||||
def __init__(self, location, name, attrs=[]):
|
||||
IDLType.__init__(self, location, name)
|
||||
self.extraTypeAttributes = attrs
|
||||
|
|
@ -2702,6 +2789,8 @@ class IDLUnresolvedType(IDLType):
|
|||
|
||||
|
||||
class IDLParametrizedType(IDLType):
|
||||
__slots__ = "builtin", "inner"
|
||||
|
||||
def __init__(self, location, name, innerType):
|
||||
IDLType.__init__(self, location, name)
|
||||
self.builtin = False
|
||||
|
|
@ -2725,6 +2814,8 @@ class IDLParametrizedType(IDLType):
|
|||
|
||||
|
||||
class IDLNullableType(IDLParametrizedType):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, innerType):
|
||||
assert not innerType == BuiltinTypes[IDLBuiltinType.Types.any]
|
||||
|
||||
|
|
@ -2900,6 +2991,8 @@ class IDLNullableType(IDLParametrizedType):
|
|||
|
||||
|
||||
class IDLSequenceType(IDLParametrizedType):
|
||||
__slots__ = ("name",)
|
||||
|
||||
def __init__(self, location, parameterType):
|
||||
assert not parameterType.isUndefined()
|
||||
|
||||
|
|
@ -2960,6 +3053,8 @@ class IDLSequenceType(IDLParametrizedType):
|
|||
|
||||
|
||||
class IDLRecordType(IDLParametrizedType):
|
||||
__slots__ = "keyType", "name"
|
||||
|
||||
def __init__(self, location, keyType, valueType):
|
||||
assert keyType.isString()
|
||||
assert keyType.isComplete()
|
||||
|
|
@ -3038,6 +3133,8 @@ class IDLRecordType(IDLParametrizedType):
|
|||
|
||||
|
||||
class IDLObservableArrayType(IDLParametrizedType):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, innerType):
|
||||
assert not innerType.isUndefined()
|
||||
IDLParametrizedType.__init__(self, location, None, innerType)
|
||||
|
|
@ -3104,6 +3201,14 @@ class IDLObservableArrayType(IDLParametrizedType):
|
|||
|
||||
|
||||
class IDLUnionType(IDLType):
|
||||
__slots__ = (
|
||||
"memberTypes",
|
||||
"hasNullableType",
|
||||
"_dictionaryType",
|
||||
"flatMemberTypes",
|
||||
"builtin",
|
||||
)
|
||||
|
||||
def __init__(self, location, memberTypes):
|
||||
IDLType.__init__(self, location, "")
|
||||
self.memberTypes = memberTypes
|
||||
|
|
@ -3247,6 +3352,8 @@ class IDLUnionType(IDLType):
|
|||
|
||||
|
||||
class IDLTypedefType(IDLType):
|
||||
__slots__ = "inner", "builtin"
|
||||
|
||||
def __init__(self, location, innerType, name):
|
||||
IDLType.__init__(self, location, name)
|
||||
self.inner = innerType
|
||||
|
|
@ -3354,6 +3461,8 @@ class IDLTypedefType(IDLType):
|
|||
|
||||
|
||||
class IDLTypedef(IDLObjectWithIdentifier):
|
||||
__slots__ = ("innerType",)
|
||||
|
||||
def __init__(self, location, parentScope, innerType, name):
|
||||
# Set self.innerType first, because IDLObjectWithIdentifier.__init__
|
||||
# will call our __str__, which wants to use it.
|
||||
|
|
@ -3386,6 +3495,8 @@ class IDLTypedef(IDLObjectWithIdentifier):
|
|||
|
||||
|
||||
class IDLWrapperType(IDLType):
|
||||
__slots__ = "inner", "_identifier", "builtin"
|
||||
|
||||
def __init__(self, location, inner):
|
||||
IDLType.__init__(self, location, inner.identifier.name)
|
||||
self.inner = inner
|
||||
|
|
@ -3582,6 +3693,8 @@ class IDLWrapperType(IDLType):
|
|||
|
||||
|
||||
class IDLPromiseType(IDLParametrizedType):
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(self, location, innerType):
|
||||
IDLParametrizedType.__init__(self, location, "Promise", innerType)
|
||||
|
||||
|
|
@ -3745,6 +3858,14 @@ class IDLBuiltinType(IDLType):
|
|||
Types.Float64Array: "Float64Array",
|
||||
}
|
||||
|
||||
__slots__ = (
|
||||
"_typeTag",
|
||||
"_clamped",
|
||||
"_rangeEnforced",
|
||||
"_withLegacyNullToEmptyString",
|
||||
"_withAllowShared",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
location,
|
||||
|
|
@ -4242,6 +4363,11 @@ class NoCoercionFoundError(WebIDLError):
|
|||
|
||||
|
||||
class IDLValue(IDLObject):
|
||||
__slots__ = (
|
||||
"type",
|
||||
"value",
|
||||
)
|
||||
|
||||
def __init__(self, location, type, value):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = type
|
||||
|
|
@ -4374,6 +4500,8 @@ class IDLValue(IDLObject):
|
|||
|
||||
|
||||
class IDLNullValue(IDLObject):
|
||||
__slots__ = "type", "value"
|
||||
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = None
|
||||
|
|
@ -4403,6 +4531,8 @@ class IDLNullValue(IDLObject):
|
|||
|
||||
|
||||
class IDLEmptySequenceValue(IDLObject):
|
||||
__slots__ = "type", "value"
|
||||
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = None
|
||||
|
|
@ -4433,6 +4563,8 @@ class IDLEmptySequenceValue(IDLObject):
|
|||
|
||||
|
||||
class IDLDefaultDictionaryValue(IDLObject):
|
||||
__slots__ = "type", "value"
|
||||
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = None
|
||||
|
|
@ -4463,6 +4595,8 @@ class IDLDefaultDictionaryValue(IDLObject):
|
|||
|
||||
|
||||
class IDLUndefinedValue(IDLObject):
|
||||
__slots__ = "type", "value"
|
||||
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = None
|
||||
|
|
@ -4492,6 +4626,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
AffectsValues = ("Nothing", "Everything")
|
||||
DependsOnValues = ("Nothing", "DOMState", "DeviceState", "Everything")
|
||||
|
||||
# no slots : multiple inheritance
|
||||
def __init__(self, location, identifier, tag, extendedAttrDict=None):
|
||||
IDLObjectWithIdentifier.__init__(self, location, None, identifier)
|
||||
IDLExposureMixins.__init__(self, location)
|
||||
|
|
@ -4611,6 +4746,14 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
|
||||
|
||||
class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
|
||||
__slots__ = (
|
||||
"keyType",
|
||||
"valueType",
|
||||
"maplikeOrSetlikeOrIterableType",
|
||||
"disallowedMemberNames",
|
||||
"disallowedNonMethodNames",
|
||||
)
|
||||
|
||||
def __init__(self, location, identifier, ifaceType, keyType, valueType, ifaceKind):
|
||||
IDLInterfaceMember.__init__(self, location, identifier, ifaceKind)
|
||||
if keyType is not None:
|
||||
|
|
@ -4827,6 +4970,8 @@ class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
|
|||
# Iterable adds ES6 iterator style functions and traits
|
||||
# (keys/values/entries/@@iterator) to an interface.
|
||||
class IDLIterable(IDLMaplikeOrSetlikeOrIterableBase):
|
||||
__slots__ = ("iteratorType",)
|
||||
|
||||
def __init__(self, location, identifier, keyType, valueType, scope):
|
||||
IDLMaplikeOrSetlikeOrIterableBase.__init__(
|
||||
self,
|
||||
|
|
@ -4902,6 +5047,8 @@ class IDLIterable(IDLMaplikeOrSetlikeOrIterableBase):
|
|||
|
||||
|
||||
class IDLAsyncIterable(IDLMaplikeOrSetlikeOrIterableBase):
|
||||
__slots__ = "iteratorType", "argList"
|
||||
|
||||
def __init__(self, location, identifier, keyType, valueType, argList, scope):
|
||||
for arg in argList:
|
||||
if not arg.optional:
|
||||
|
|
@ -4986,6 +5133,8 @@ class IDLAsyncIterable(IDLMaplikeOrSetlikeOrIterableBase):
|
|||
|
||||
# MaplikeOrSetlike adds ES6 map-or-set-like traits to an interface.
|
||||
class IDLMaplikeOrSetlike(IDLMaplikeOrSetlikeOrIterableBase):
|
||||
__slots__ = "readonly", "slotIndices", "prefix"
|
||||
|
||||
def __init__(
|
||||
self, location, identifier, maplikeOrSetlikeType, readonly, keyType, valueType
|
||||
):
|
||||
|
|
@ -5153,6 +5302,8 @@ class IDLMaplikeOrSetlike(IDLMaplikeOrSetlikeOrIterableBase):
|
|||
|
||||
|
||||
class IDLConst(IDLInterfaceMember):
|
||||
__slots__ = "type", "value"
|
||||
|
||||
def __init__(self, location, identifier, type, value):
|
||||
IDLInterfaceMember.__init__(
|
||||
self, location, identifier, IDLInterfaceMember.Tags.Const
|
||||
|
|
@ -5225,6 +5376,21 @@ class IDLConst(IDLInterfaceMember):
|
|||
|
||||
|
||||
class IDLAttribute(IDLInterfaceMember):
|
||||
__slots__ = (
|
||||
"type",
|
||||
"readonly",
|
||||
"inherit",
|
||||
"_static",
|
||||
"legacyLenientThis",
|
||||
"_legacyUnforgeable",
|
||||
"stringifier",
|
||||
"slotIndices",
|
||||
"maplikeOrSetlike",
|
||||
"dependsOn",
|
||||
"affects",
|
||||
"bindingAliases",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
location,
|
||||
|
|
@ -5827,6 +5993,18 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
|
||||
|
||||
class IDLArgument(IDLObjectWithIdentifier):
|
||||
__slots__ = (
|
||||
"type",
|
||||
"optional",
|
||||
"defaultValue",
|
||||
"variadic",
|
||||
"dictionaryMember",
|
||||
"_isComplete",
|
||||
"_allowTreatNonCallableAsNull",
|
||||
"_extendedAttrDict",
|
||||
"allowTypeAttributes",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
location,
|
||||
|
|
@ -5970,6 +6148,15 @@ class IDLArgument(IDLObjectWithIdentifier):
|
|||
|
||||
|
||||
class IDLCallback(IDLObjectWithScope):
|
||||
__slots__ = (
|
||||
"_returnType",
|
||||
"_arguments",
|
||||
"_treatNonCallableAsNull",
|
||||
"_treatNonObjectAsNull",
|
||||
"_isRunScriptBoundary",
|
||||
"_isConstructor",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self, location, parentScope, identifier, returnType, arguments, isConstructor
|
||||
):
|
||||
|
|
@ -6067,6 +6254,8 @@ class IDLCallback(IDLObjectWithScope):
|
|||
|
||||
|
||||
class IDLCallbackType(IDLType):
|
||||
__slots__ = ("callback",)
|
||||
|
||||
def __init__(self, location, callback):
|
||||
IDLType.__init__(self, location, callback.identifier.name)
|
||||
self.callback = callback
|
||||
|
|
@ -6109,6 +6298,8 @@ class IDLMethodOverload:
|
|||
the full set of overloads.
|
||||
"""
|
||||
|
||||
__slots__ = "returnType", "arguments", "location"
|
||||
|
||||
def __init__(self, returnType, arguments, location):
|
||||
self.returnType = returnType
|
||||
# Clone the list of arguments, just in case
|
||||
|
|
@ -6131,6 +6322,25 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
|
||||
NamedOrIndexed = enum("Neither", "Named", "Indexed")
|
||||
|
||||
__slots__ = (
|
||||
"_hasOverloads",
|
||||
"_overloads",
|
||||
"_static",
|
||||
"_getter",
|
||||
"_setter",
|
||||
"_deleter",
|
||||
"_legacycaller",
|
||||
"_stringifier",
|
||||
"maplikeOrSetlikeOrIterable",
|
||||
"_htmlConstructor",
|
||||
"underlyingAttr",
|
||||
"_specialType",
|
||||
"_legacyUnforgeable",
|
||||
"dependsOn",
|
||||
"affects",
|
||||
"aliases",
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
location,
|
||||
|
|
@ -6797,6 +7007,14 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
|
||||
|
||||
class IDLConstructor(IDLMethod):
|
||||
__slots__ = (
|
||||
"_initLocation",
|
||||
"_initArgs",
|
||||
"_initName",
|
||||
"_inited",
|
||||
"_initExtendedAttrs",
|
||||
)
|
||||
|
||||
def __init__(self, location, args, name):
|
||||
# We can't actually init our IDLMethod yet, because we do not know the
|
||||
# return type yet. Just save the info we have for now and we will init
|
||||
|
|
@ -6866,6 +7084,8 @@ class IDLConstructor(IDLMethod):
|
|||
|
||||
|
||||
class IDLIncludesStatement(IDLObject):
|
||||
__slots__ = ("interface", "mixin", "_finished")
|
||||
|
||||
def __init__(self, location, interface, mixin):
|
||||
IDLObject.__init__(self, location)
|
||||
self.interface = interface
|
||||
|
|
@ -6922,6 +7142,8 @@ class IDLExtendedAttribute(IDLObject):
|
|||
A class to represent IDL extended attributes so we can give them locations
|
||||
"""
|
||||
|
||||
__slots__ = ("_tuple",)
|
||||
|
||||
def __init__(self, location, tuple):
|
||||
IDLObject.__init__(self, location)
|
||||
self._tuple = tuple
|
||||
|
|
|
|||
Loading…
Reference in a new issue