Closed Bug 841429 Opened 9 years ago Closed 9 years ago

passing optional integer arguments with default values in callback interface generates invalid code

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: mccr8, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

callback interface Foo {
void passOptionalByteWithDefault(optional byte arg = 0);
};

generates code like:

    if (arg.WasPassed()) {
      argv[0] = INT_TO_JSVAL(int32_t(arg.Value()));
      break;

where arg is int8_t
As you may guess, this also applies to the other integer types.
Summary: passing optional byte with default argument in callback interface generates invalid code → passing optional integer arguments with default values in callback interface generates invalid code
Also for at least one non-integer pattern this fails:

callback interface Foo {
  void passOptionalSelfWithDefault(optional Foo? arg = null);
};

with errors like: 

/Users/amccreight/mz/cent/obj-dbg/dom/bindings/JSImplBinding.cpp:35:12: error: member reference type 'mozilla::dom::Foo *' is a pointer; maybe you meant to use '->'?
    if (arg.WasPassed()) {
        ~~~^
           ->
/Users/amccreight/mz/cent/obj-dbg/dom/bindings/JSImplBinding.cpp:35:13: error: no member named 'WasPassed' in 'mozilla::dom::Foo'
    if (arg.WasPassed()) {
        ~~~ ^

Presumably basically the same thing...
Blocks: 823512
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Attachment #731386 - Flags: review?(continuation) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/592316b9ce80
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla23
https://hg.mozilla.org/mozilla-central/rev/592316b9ce80
Status: NEW → RESOLVED
Closed: 9 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.