Closed
Bug 1787444
Opened 4 years ago
Closed 4 years ago
Don't generate union conversion code in its own scope if it has been put in a if-else scope
Categories
(Core :: DOM: Bindings (WebIDL), enhancement)
Core
DOM: Bindings (WebIDL)
Tracking
()
RESOLVED
DUPLICATE
of bug 1784266
People
(Reporter: edgar, Assigned: edgar)
Details
Attachments
(1 file, 2 obsolete files)
|
94.31 KB,
patch
|
Details | Diff | Splinter Review |
For example,
if (!(args.hasDefined(0)) || args[0].isNullOrUndefined()) {
arg0.SetNull();
} else {
arg0_holder.emplace(arg0.SetValue());
{
bool done = false, failed = false, tryNext;
do {
if (args[0].isNumber()) {
done = (failed = !arg0_holder.ref().TrySetToDouble(cx, args[0], tryNext)) || !tryNext;
break;
}
done = (failed = !arg0_holder.ref().TrySetToUTF8String(cx, args[0], tryNext)) || !tryNext;
break;
} while (false);
if (failed) {
return false;
}
if (!done) {
cx.ThrowErrorMessage<MSG_NOT_IN_UNION>("Argument 1", "");
return false;
}
}
}
Found this while working on bug 1784266, and realize it might be better to address this in a separated bug.
| Assignee | ||
Comment 1•4 years ago
|
||
| Assignee | ||
Comment 2•4 years ago
|
||
| Assignee | ||
Comment 3•4 years ago
|
||
Attachment #9291744 -
Attachment is obsolete: true
Updated•4 years ago
|
Attachment #9291743 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•4 years ago
|
||
https://phabricator.services.mozilla.com/D156176 will also remove unnecessary { } scope.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•