Closed Bug 1335000 Opened 7 years ago Closed 7 years ago

[Static Analysis] Operator= should return a OwningUnrestrictedDoubleOrString&

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Codechecker detected that operator= should return a OwningUnrestrictedDoubleOrString&
https://dxr.mozilla.org/mozilla-central/source/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/UnionTypes.h#14247

By having it return void we suppress the usage of expressions like:

a = b = c
Attachment #8831684 - Flags: review?(amarchesini) → review?(peterv)
Comment on attachment 8831684 [details]
Bug 1335000 - return type& for copy assignment operator.

https://reviewboard.mozilla.org/r/108240/#review109894

::: dom/bindings/Codegen.py:10230
(Diff revision 1)
>                          bodyInHeader=True,
>                          visibility="public",
>                          explicit=True,
>                          body="*this = aOther;\n"))
> +                op_body=CGSwitch("aOther.mType", assignmentCases);
> +                op_body.append(CGGeneric("return *this;\n"));

This seems wrong, CGSwitch being a list is an implementation detail. Please create your own CGList containing the CGSwitch and the CGGeneric.
Attachment #8831684 - Flags: review?(peterv) → review-
Comment on attachment 8831684 [details]
Bug 1335000 - return type& for copy assignment operator.

https://reviewboard.mozilla.org/r/108240/#review113402
Attachment #8831684 - Flags: review?(peterv) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/65b1e4b706e2
return type& for copy assignment operator. r=peterv
https://hg.mozilla.org/mozilla-central/rev/65b1e4b706e2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: