Closed Bug 970764 Opened 6 years ago Closed 6 years ago

Stop allowing "optional any" with no default value in WebIDL arguments


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

Not set





(Reporter: bzbarsky, Assigned: bzbarsky)




(1 file, 3 obsolete files)

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
Attachment #8374314 - Attachment is obsolete: true
Attachment #8374314 - Flags: review?(khuey)
Whiteboard: [need review]
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/
@@ +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.  ;) with the issues fixed.
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla30
Closed: 6 years ago
Resolution: --- → FIXED
Depends on: 985536
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.
Attachment #8393634 - Attachment is obsolete: true
Attachment #8393634 - Flags: review?(khuey)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.