Closed Bug 970764 Opened 10 years ago Closed 10 years ago

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

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(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/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.
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla30
https://hg.mozilla.org/mozilla-central/rev/fed727c12315
Status: NEW → RESOLVED
Closed: 10 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.

Attachment

General

Created:
Updated:
Size: