Files
sdk/pkg/dev_compiler/test/codegen/destructuring.dart
T
Jenny Messerly 1ef4399df0 Run dartfmt --fix for dart2 on pkg/dev_compiler
This uses optional new/const and `=` in named argument defaults.

All changes are automated, except for:

- utils/dartdevc/BUILD.gn: run DDC build scripts with --preview-dart-2
- pkg/dev_compiler/tool/patch_sdk.dart: add a TODO that Analyzer doesn't
  supporting implicit const in libraries.dart
- pkg/dev_compiler/tool/input_sdk/libraries.dart: was not formatted due
  to the aforementioned Analyzer bug
- tools/bots/test_matrix.json: run DDC sourcemap suite in Dart 2 mode
- pkg/pkg.status: skip pkg/dev_compiler if running in Dart 1 mode

Change-Id: I9b80ccba0c2cc7b66efc662a0b16562e3660aee3
Reviewed-on: https://dart-review.googlesource.com/60402
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-06-15 00:28:13 +00:00

48 lines
1.1 KiB
Dart

// compile options: --destructure-named-params
import 'dart-ext:foo';
import 'package:js/src/varargs.dart';
f(int a, b, [c = 1]) {
f(a, b, c);
}
external f_ext(int a, b, [c = 1]);
f_nat(int a, b, [c = 1]) native "f_nat";
f_sync(int a, b, [c = 1]) sync* {}
f_async(int a, b, [c = 1]) async* {}
g(int a, b, {c = 1}) {
f(a, b, c);
}
external g_ext(int a, b, {c = 1});
g_nat(int a, b, {c = 1}) native "g_nat";
g_sync(int a, b, {c = 1}) sync* {}
g_async(int a, b, {c = 1}) async* {}
r(int a, @rest others) {
r(a, spread(others));
}
external r_ext(int a, @rest others);
r_nat(int a, @rest others) native "r_nat";
r_sync(int a, @rest others) sync* {}
r_async(int a, @rest others) async* {}
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);
}