Closed Bug 895728 Opened 12 years ago Closed 12 years ago

make Web IDL bindings support distinguishing primitive types and DOMString

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: heycam, Assigned: bzbarsky)

References

Details

Attachments

(5 files, 2 obsolete files)

Web IDL now supports distinguishing primitive types and DOMString for overload resolution and enum types.
Assignee: nobody → bzbarsky
Attachment #778265 - Flags: review?(khuey)
Attachment #778263 - Attachment is obsolete: true
Attachment #778263 - Flags: review?(khuey)
Comment on attachment 778265 [details] [diff] [review] With a bit more cleanup Spec is changing more. :(
Attachment #778265 - Flags: review?(khuey)
Spec is now updated to have boolean, numeric types and DOMString all be distinguishable.
Comment on attachment 778798 [details] [diff] [review] part 3. Fix overload resolution to work with the new boolean/numeric/string setup. Review of attachment 778798 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Codegen.py @@ +5070,5 @@ > + if numericSignature: > + addCase(numericSignature, numericCondition) > + if stringSignature: > + addCase(stringSignature, None) > + trailing ws
Comment on attachment 778799 [details] [diff] [review] part 4. Fix unions to work with the new boolean/numeric/string setup. Review of attachment 778799 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Codegen.py @@ +2930,5 @@ > else: > templateBody = CGGeneric() > > + stringTypes = filter(lambda t: t.isString() or t.isEnum(), > + memberTypes) [t if t.isString() or t.isEnum() for t in memberTypes] would be more idiomatic, I think.
> trailing ws Fixed. > [t if t.isString() or t.isEnum() for t in memberTypes] would be more idiomatic, I think. Good catch. I was just copying the existing code, but that was already suboptimal. ;)
Attachment #779023 - Flags: review?(khuey)
Attachment #778799 - Attachment is obsolete: true
Attachment #778799 - Flags: review?(khuey)
Whiteboard: [need review]
Comment on attachment 778800 [details] [diff] [review] part 2. Make booleans, numerics, and strings/enums all be distinguishable from each other. Review of attachment 778800 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +2165,5 @@ > + return (other.isNumeric() or other.isString() or other.isEnum() or > + other.isInterface() or other.isObject() or > + other.isCallback() or other.isDictionary() or > + other.isSequence() or other.isArray() or > + other.isDate()) Wouldn't this be easier as 'return not other.isBoolean()'? @@ +2171,5 @@ > + return (other.isBoolean() or other.isString() or other.isEnum() or > + other.isInterface() or other.isObject() or > + other.isCallback() or other.isDictionary() or > + other.isSequence() or other.isArray() or > + other.isDate()) Similarly here?
Attachment #778800 - Flags: review?(khuey) → review+
Comment on attachment 778798 [details] [diff] [review] part 3. Fix overload resolution to work with the new boolean/numeric/string setup. Review of attachment 778798 [details] [diff] [review]: ----------------------------------------------------------------- Note Ms2ger's comment.
Attachment #778798 - Flags: review?(khuey) → review+
> Wouldn't this be easier as 'return not other.isBoolean()'? It'd have to be 'return not other.isBoolean() and not other.isAny()', I think. Which is why I didn't do it: it's a less-direct translation of the distinguishability table to do it that way... I can change it if you prefer; let me know.
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: