Closed Bug 815502 Opened 12 years ago Closed 12 years ago

Implement variadic arguments for WebIDL methods

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

This is needed for things like the recent changes to ClassList.add/remove.
Blocks: 814014
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Comment on attachment 685723 [details] [diff] [review] Implement support for variadic arguments in WebIDL. Review of attachment 685723 [details] [diff] [review]: ----------------------------------------------------------------- r=me on the WebIDL.py bits.
Attachment #685723 - Flags: review+
Comment on attachment 685723 [details] [diff] [review] Implement support for variadic arguments in WebIDL. Review of attachment 685723 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Codegen.py @@ +3068,5 @@ > + > + # NOTE: Keep this in sync with sequence conversions as needed > + variadicConversion = string.Template("""const ${seqType} ${declName}; > +if (${argc} > ${index}) { > + ${seqType} &arr = const_cast< ${seqType}& >(${declName}); I think we usually do |${seqType}& arr|. @@ +3074,5 @@ > + if (!arr.SetCapacity(${argc} - ${index})) { > + JS_ReportOutOfMemory(cx); > + return false; > + } > + for (uint32_t variadicArg = 0; variadicArg < length; ++variadicArg) { How do you feel about making this go from ${index} to ${argc} (and val would just be ${argv}[variadicArg]). I think that would be slightly clearer. @@ +6819,5 @@ > > class CGNativeMember(ClassMethod): > def __init__(self, descriptor, member, name, signature, extendedAttrs, > breakAfter=True, passCxAsNeeded=True, visibility="public", > + jsObjectsArePtr=False, variadicIsSequence=False): Could you explain variadicIsSequence, when would one pass in (the default) False?
> I think we usually do |${seqType}& arr|. Done. > How do you feel about making this go from ${index} to ${argc} Done. > Could you explain variadicIsSequence, when would one pass in (the default) False? And have it actually matter? Right now, for callback function codegen, which takes an nsTArray for variadics, not a Sequence.
Attachment #685723 - Flags: review?(peterv) → review+
Flags: in-testsuite+
Keywords: dev-doc-needed
Whiteboard: [need review]
Target Milestone: --- → mozilla20
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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: