Closed Bug 970764 Opened 6 years ago Closed 6 years ago
Stop allowing "optional any" with no default value in Web
The current plan is to support either "any arg" which is always optional and has undefined as default value or "optional any arg = null", which is also optional and has null as default value. I considered trying to support "any arg = null", but that needs grammar changes...
Attachment #8373825 - Attachment is obsolete: true
Comment on attachment 8374372 [details] [diff] [review] Remove support for non-optional "any" arguments values, since "any" needs to be able to include undefined anyway. Have "any" arguments and dictionary entries default to undefined unless the IDL explicitly says "= null". Review of attachment 8374372 [details] [diff] [review]: ----------------------------------------------------------------- I assumed you got all the relevant interfaces. ::: dom/bindings/parser/WebIDL.py @@ +2531,5 @@ > > def _getDependentObjects(self): > return set() > > +class IDLUndefinedValue(IDLObject): nit: while you're here, remove the whitespace on the previous line @@ +2927,5 @@ > # so the codegen doesn't have to special-case this. > self.defaultValue = IDLNullValue(self.location) > + elif self.type.isAny(): > + if (self.optional and not self.variadic and > + not self.dictionaryMember and not self.defaultValue): Worth asserting that if self.defaultValue is not None it's an IDLNullValue? @@ +4320,5 @@ > [self.getLocation(p, 6)]) > > + # We can't test t.isAny() here and force optional to true, since at this > + # point t is not a fully resolved type yet (e.g. it might be a typedef). > + # We'll the 'any' case in IDLArgument.complete. you accidentally a verb
Attachment #8374372 - Flags: review?(khuey) → review+
> I assumed you got all the relevant interfaces. At least it compiles. ;)
https://hg.mozilla.org/integration/mozilla-inbound/rev/fed727c12315 with the issues fixed.
Whiteboard: [need review]
Target Milestone: --- → mozilla30
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Comment on attachment 8393634 [details] [diff] [review] Go back to allowing optional any with no default value in WebIDL, but treat it as having a default value of undefined. Wrong bug.
You need to log in before you can comment on or make changes to this bug.