OLD | NEW |
1 // compile options: --closure-experimental --destructure-named-params --modules=
es6 | 1 // compile options: --closure-experimental --destructure-named-params --modules=
es6 |
2 library test; | 2 library test; |
| 3 |
3 import 'dart:js'; | 4 import 'dart:js'; |
4 | 5 |
5 List/*<T>*/ generic_function/*<T>*/(List/*<T>*/ items, dynamic/*=T*/ seed) { | 6 List/*<T>*/ generic_function/*<T>*/(List/*<T>*/ items, dynamic/*=T*/ seed) { |
6 var strings = items.map((i) => "$i").toList(); | 7 var strings = items.map((i) => "$i").toList(); |
7 return items; | 8 return items; |
8 } | 9 } |
9 | 10 |
10 typedef void Callback({int i}); | 11 typedef void Callback({int i}); |
11 | 12 |
12 class Foo<T> { | 13 class Foo<T> { |
13 final int i; | 14 final int i; |
14 bool b; | 15 bool b; |
15 String s; | 16 String s; |
16 T v; | 17 T v; |
17 | 18 |
18 Foo(this.i, this.v); | 19 Foo(this.i, this.v); |
19 | 20 |
20 factory Foo.build() => new Foo(1, null); | 21 factory Foo.build() => new Foo(1, null); |
21 | 22 |
22 untyped_method(a, b) {} | 23 untyped_method(a, b) {} |
23 | 24 |
24 T pass(T t) => t; | 25 T pass(T t) => t; |
25 | 26 |
26 String typed_method( | 27 String typed_method(Foo foo, List list, int i, num n, double d, bool b, |
27 Foo foo, List list, | 28 String s, JsArray a, JsObject o, JsFunction f) { |
28 int i, num n, double d, bool b, String s, | |
29 JsArray a, JsObject o, JsFunction f) { | |
30 return ''; | 29 return ''; |
31 } | 30 } |
32 | 31 |
33 optional_params(a, [b, int c]) {} | 32 optional_params(a, [b, int c]) {} |
34 | 33 |
35 static named_params(a, {b, int c}) {} | 34 static named_params(a, {b, int c}) {} |
36 | 35 |
37 nullary_method() {} | 36 nullary_method() {} |
38 | 37 |
39 function_params(int f(x, [y]), g(x, {String y, z}), Callback cb) { | 38 function_params(int f(x, [y]), g(x, {String y, z}), Callback cb) { |
40 cb(i: i); | 39 cb(i: i); |
41 } | 40 } |
42 | 41 |
43 run(List a, String b, List c(String d), List<int> e(f(g)), {Map<Map, Map> h})
{} | 42 run(List a, String b, List c(String d), List<int> e(f(g)), |
| 43 {Map<Map, Map> h}) {} |
44 | 44 |
45 String get prop => null; | 45 String get prop => null; |
46 set prop(String value) {} | 46 set prop(String value) {} |
47 | 47 |
48 static String get staticProp => null; | 48 static String get staticProp => null; |
49 static set staticProp(String value) {} | 49 static set staticProp(String value) {} |
50 | 50 |
51 static const String some_static_constant = "abc"; | 51 static const String some_static_constant = "abc"; |
52 static final String some_static_final = "abc"; | 52 static final String some_static_final = "abc"; |
53 static String some_static_var = "abc"; | 53 static String some_static_var = "abc"; |
54 } | 54 } |
55 | 55 |
56 class Bar {} | 56 class Bar {} |
57 | 57 |
58 class Baz extends Foo<int> with Bar { | 58 class Baz extends Foo<int> with Bar { |
59 Baz(int i) : super(i, 123); | 59 Baz(int i) : super(i, 123); |
60 } | 60 } |
61 | 61 |
62 void main(args) {} | 62 void main(args) {} |
63 | 63 |
64 var closure = () { return; }; | 64 var closure = () { |
| 65 return; |
| 66 }; |
65 | 67 |
66 const String some_top_level_constant = "abc"; | 68 const String some_top_level_constant = "abc"; |
67 final String some_top_level_final = "abc"; | 69 final String some_top_level_final = "abc"; |
68 String some_top_level_var = "abc"; | 70 String some_top_level_var = "abc"; |
OLD | NEW |