Closed Bug 768190 Opened 13 years ago Closed 13 years ago

Dictionary members should not allow [TreatNullAs] or [TreatUndefinedAs] annotations

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

Spec says so.
Honestly, unless this is really easy to implement in the parser (and it's not clear that it would be), I don't think we should bother.
See above: pretty trivial to implement, imo.
Comment on attachment 636473 [details] [diff] [review] Don't allow [TreatNullAs] or [TreatUndefinedAs] on dictionary members. > class IDLArgument(IDLObjectWithIdentifier): >- def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False): >+ def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False): > IDLObjectWithIdentifier.__init__(self, location, None, identifier) > > assert isinstance(type, IDLType) > self.type = type > > if defaultValue: > defaultValue = defaultValue.coerceToType(type, location) > assert defaultValue > > self.optional = optional > self.defaultValue = defaultValue > self.variadic = variadic >+ self.dictionaryMember = dictionaryMember > > assert not variadic or optional > > def addExtendedAttributes(self, attrs): >+ if self.dictionaryMember: >+ for (attr, value) in attrs: >+ if attr == "TreatUndefinedAs": >+ raise WebIDLError("[TreatUndefinedAs] is not allowed for " >+ "dictionary members", [self.location]) >+ elif attr == "TreatNullAs": >+ raise WebIDLError("[TreatNullAs] is not allowed for " >+ "dictionary members", [self.location]) This could be just |if 'TreatUndefinedAs' in attrs| and so on.
Attachment #636473 - Flags: review?(justin.lebar+bug) → review+
> This could be just |if 'TreatUndefinedAs' in attrs| and so on. Attrs is a list of tuples, so I'm not sure it could.
Flags: in-testsuite+
Target Milestone: --- → mozilla16
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: