mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 963321 part 1. Add WebIDL parser support for having [Cached] dictionary attributes. r=khuey
We don't know at handleExtendedAttribute time what the identifier will map to, so have to do the check that [Frozen] is not being misused later.
This commit is contained in:
parent
dbc89c0f19
commit
8ad668ddf4
@ -2656,7 +2656,7 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
assert not isinstance(t.name, IDLUnresolvedIdentifier)
|
||||
self.type = t
|
||||
|
||||
if self.type.isDictionary():
|
||||
if self.type.isDictionary() and not self.getExtendedAttribute("Cached"):
|
||||
raise WebIDLError("An attribute cannot be of a dictionary type",
|
||||
[self.location])
|
||||
if self.type.isSequence() and not self.getExtendedAttribute("Cached"):
|
||||
@ -2693,7 +2693,11 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
"slots must be constant or pure, since the "
|
||||
"getter won't always be called.",
|
||||
[self.location])
|
||||
pass
|
||||
if self.getExtendedAttribute("Frozen"):
|
||||
if not self.type.isSequence() and not self.type.isDictionary():
|
||||
raise WebIDLError("[Frozen] is only allowed on sequence-valued "
|
||||
"and dictionary-valued attributes",
|
||||
[self.location])
|
||||
|
||||
def handleExtendedAttribute(self, attr):
|
||||
identifier = attr.identifier()
|
||||
@ -2799,10 +2803,6 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
raise WebIDLError("[LenientThis] is not allowed in combination "
|
||||
"with [%s]" % identifier,
|
||||
[attr.location, self.location])
|
||||
elif identifier == "Frozen":
|
||||
if not self.type.isSequence():
|
||||
raise WebIDLError("[Frozen] is only allowed on sequence-valued "
|
||||
"attributes", [attr.location, self.location])
|
||||
elif (identifier == "Pref" or
|
||||
identifier == "SetterThrows" or
|
||||
identifier == "Pure" or
|
||||
@ -2812,6 +2812,7 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
identifier == "SameObject" or
|
||||
identifier == "Constant" or
|
||||
identifier == "Func" or
|
||||
identifier == "Frozen" or
|
||||
identifier == "NewObject"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user