Open Bug 1471429 Opened 7 years ago Updated 3 years ago

Allow dicts containing single-use unions of same-file dicts in WebIDL codegen

Categories

(Core :: DOM: Bindings (WebIDL), enhancement, P3)

enhancement

Tracking

()

People

(Reporter: qdot, Unassigned)

References

Details

Followup for bug 1469376. From :bz's comment (https://bugzilla.mozilla.org/show_bug.cgi?id=1469376#c12): --- So there are two possible cases. If the union lives in UnionTypes.h, because it's used in multiple bindings, then we will in fact have a circularity problem here: the binding header will try to include UnionTypes.h for the dictionary member, which will try to include the binding header for the dictionary inside the union, and bad things will happen. Most importantly, those bad things will lead to really hard to diagnose compilation failures, which is why we have this check in codegen: it makes it simple to tell what the problem is and fix it. The second case is that the union lives in a single binding header: it's only used from this dictionary. In that case, things will in fact work correctly, because in bug 1068740 we added unions to the set of things we pass to dependencySortObjects, so the unions and dictionaries within that single header will be sorted in an order that makes everything work. Testing this would involve using a union not used anywhere else in TestCodeGen.webidl; not sure whether you were doing that. Anyway, what I think we should do here is factor out the logic in getUnionDeclarationFilename so we have a predicate for "does this union live in UnionTypes.h?" and use that predicate from both getUnionDeclarationFilename and here. If that tests false, then we can skip the rest of the checking being done here. --- In addition, once this check is added to codegen, we should combine dicts with the interfaces that use them, where possible.
Priority: -- → P3
Assignee: kyle → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.