Closed
Bug 949501
Opened 11 years ago
Closed 11 years ago
Fix support for nullable unions in sequences and dictionaries
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
|
9.64 KB,
patch
|
dzbarsky
:
review+
|
Details | Diff | Splinter Review |
This got missed in bug 767926.
Sequences and dictionaries assert that their member types have no holders. Which is fine, but nullable unions were in fact producing a (unusable) holder.
Patch coming up.
| Assignee | ||
Comment 1•11 years ago
|
||
Attachment #8346609 -
Flags: review?(dzbarsky)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 2•11 years ago
|
||
Comment on attachment 8346609 [details] [diff] [review]
Make nullable unions that are isMember stop claiming to have a holder.
Review of attachment 8346609 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/Codegen.py
@@ +3320,5 @@
> holderArgs = "${declName}.SetValue()"
> + if holderType is not None:
> + holderType = CGTemplatedType("Maybe", holderType)
> + constructHolder = CGGeneric("${holderName}.construct(%s);" % holderArgs)
> + else:
I think this is getting a little complicated. holderType is not None only when not isMember, so maybe this could be
if isMember:
holderType = CGTempaltedType("Maybe", CGGeneric(argumentTypeName)) and set it to CGGeneric(argumentTypeName) in the else and to None otherwise?
It's probably a little longer but maybe easier to reason about.
Attachment #8346609 -
Flags: review?(dzbarsky) → review+
| Assignee | ||
Comment 3•11 years ago
|
||
I'm not sure I follow. We have three cases here:
1) not isMember, nullable: holderType should be a "Maybe"
2) not isMember, non-nullable: holderType should be argumentTypeName
3) isMember: holderType should be None
which is fine, but case 1 has additional complexity, because the constructHolder depends on isOptional.
So I could basically structure this like so:
if nullable:
# do the optional bits
if isMember:
holderType = None
else:
holderType = CGTemplatedType("Maybe", CGGeneric(argumentTypeName))
else:
if isMember:
holderType = None
else:
holderType = CGGeneric(argumentTypeName)
Is that what you're suggesting? Or something else?
Flags: needinfo?(dzbarsky)
Comment 4•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] (Vacation Dec 19 to Jan 1) from comment #3)
> I'm not sure I follow. We have three cases here:
>
> 1) not isMember, nullable: holderType should be a "Maybe"
> 2) not isMember, non-nullable: holderType should be argumentTypeName
> 3) isMember: holderType should be None
>
> which is fine, but case 1 has additional complexity, because the
> constructHolder depends on isOptional.
>
> So I could basically structure this like so:
>
> if nullable:
> # do the optional bits
> if isMember:
> holderType = None
> else:
> holderType = CGTemplatedType("Maybe", CGGeneric(argumentTypeName))
> else:
> if isMember:
> holderType = None
> else:
> holderType = CGGeneric(argumentTypeName)
>
> Is that what you're suggesting? Or something else?
How about something like so:
if isMember:
holderType = None
else:
holderType = CGGeneric(argumentTypeName)
if nullable:
holderType = CGTemplatedType("Maybe", holderType)
and then initialize the rest of the holder and decl stuff after that?
Flags: needinfo?(dzbarsky)
| Assignee | ||
Comment 5•11 years ago
|
||
With that change, https://hg.mozilla.org/integration/mozilla-inbound/rev/745ca55d396a
Flags: in-testsuite+
Target Milestone: --- → mozilla29
Comment 6•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 7•11 years ago
|
||
Working on bug 949456 I still see errors:
MessageEventBinding.cpp:170:37: error: ‘class mozilla::dom::Optional<mozilla::dom::Nullable<mozilla::dom::OwningWindowProxyOrMessagePort> >’ has no member named ‘SetValue’
MessageEventBinding.cpp:171:37: error: ‘class mozilla::dom::Optional<mozilla::dom::Nullable<mozilla::dom::OwningWindowProxyOrMessagePort> >’ has no member named ‘SetValue’
MessageEventBinding.cpp:308:105: error: invalid initialization of reference of type ‘const mozilla::dom::Optional<mozilla::dom::Nullable<mozilla::dom::OwningWindowProxyOrMessagePort> >&’ from expression of type ‘const mozilla::dom::Nullable<mozilla::dom::OwningWindowProxyOrMessagePort>’
MessageEventBinding.cpp:309:24: error: ‘const class mozilla::dom::Optional<mozilla::dom::Nullable<mozilla::dom::OwningWindowProxyOrMessagePort> >’ has no member named ‘IsNull’
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 8•11 years ago
|
||
Hmm. That's actually a slightly separate issue which only affects dictionary member unions without default values, which I missed because the tests I added all used things with default values by accident. I filed bug 952073 to deal with that.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•