0afdd61031
- Destructure named params that clash with JS reserved names:
`f({arguments = 1}) {}` becomes `function f({['arguments']: arguments$ = 1} = {}) {}`
- Use ES6 default params for positional & optional parameters
- Added simple tests
BUG=
R=jmesserly@google.com
Review URL: https://codereview.chromium.org/1677863002 .
21 lines
460 B
Dart
21 lines
460 B
Dart
f(int a, b, [c = 1]) {
|
|
f(a, b, c);
|
|
}
|
|
g(int a, b, {c : 1}) {
|
|
f(a, b, c);
|
|
}
|
|
|
|
invalid_names1(int let, function, arguments) {
|
|
f(let, function, arguments);
|
|
}
|
|
invalid_names2([int let, function = 1, arguments]) {
|
|
f(let, function, arguments);
|
|
}
|
|
invalid_names3({int let, function, arguments : 2}) {
|
|
f(let, function, arguments);
|
|
}
|
|
|
|
names_clashing_with_object_props({int constructor, valueOf, hasOwnProperty : 2}) {
|
|
f(constructor, valueOf, hasOwnProperty);
|
|
}
|