1ef4399df0
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>
71 lines
1.4 KiB
Dart
71 lines
1.4 KiB
Dart
// compile options: --closure-experimental --destructure-named-params --modules=es6
|
|
library test;
|
|
|
|
import 'dart:js';
|
|
|
|
List<T> generic_function<T>(List<T> items, T seed) {
|
|
var strings = items.map((i) => "$i").toList();
|
|
return items;
|
|
}
|
|
|
|
typedef void Callback({int i});
|
|
|
|
class Foo<T> {
|
|
final int i;
|
|
bool b;
|
|
String s;
|
|
T v;
|
|
|
|
Foo(this.i, this.v);
|
|
|
|
factory Foo.build() => Foo(1, null);
|
|
|
|
untyped_method(a, b) {}
|
|
|
|
T pass(T t) => t;
|
|
|
|
String typed_method(Foo foo, List list, int i, num n, double d, bool b,
|
|
String s, JsArray a, JsObject o, JsFunction f) {
|
|
return '';
|
|
}
|
|
|
|
optional_params(a, [b, int c]) {}
|
|
|
|
static named_params(a, {b, int c}) {}
|
|
|
|
nullary_method() {}
|
|
|
|
function_params(int f(x, [y]), g(x, {String y, z}), Callback cb) {
|
|
cb(i: i);
|
|
}
|
|
|
|
run(List a, String b, List c(String d), List<int> e(f(g)),
|
|
{Map<Map, Map> h}) {}
|
|
|
|
String get prop => null;
|
|
set prop(String value) {}
|
|
|
|
static String get staticProp => null;
|
|
static set staticProp(String value) {}
|
|
|
|
static const String some_static_constant = "abc";
|
|
static final String some_static_final = "abc";
|
|
static String some_static_var = "abc";
|
|
}
|
|
|
|
class Bar {}
|
|
|
|
class Baz extends Foo<int> with Bar {
|
|
Baz(int i) : super(i, 123);
|
|
}
|
|
|
|
void main(args) {}
|
|
|
|
var closure = () {
|
|
return;
|
|
};
|
|
|
|
const String some_top_level_constant = "abc";
|
|
final String some_top_level_final = "abc";
|
|
String some_top_level_var = "abc";
|