You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use ES6 destructuring to handle optional positional arguments more compactly.
Note, this doesn't actually change calling convention in DDC, just how
optionals are handled at the callee.
Given Dart:
void foo(arg1, arg2, [opt1, opt2 = def2]) {
...
}
old JS:
function foo(arg1, arg2, opt1, opt2) {
if (opt1 === void 0) opt1 = null;
if (opt2 === void 0) opt2 = 42;
...
}
new JS:
function foo(arg1, arg2, opt1 = null, opt2 = def2) {
...
}
We should be able to similar with named params.
Change-Id: I8491a4517d729ab1dec40c1ed2073b9c33cdffe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124107
Reviewed-by: Mark Zhou <[email protected]>
Commit-Queue: Vijay Menon <[email protected]>
0 commit comments