OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test compilation equivalence between source and .dill based | 5 // Test compilation equivalence between source and .dill based |
6 // compilation using the default emitter (full_emitter). | 6 // compilation using the default emitter (full_emitter). |
7 library dart2js.kernel.compile_from_dill_test; | 7 library dart2js.kernel.compile_from_dill_test; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
11 import '../serialization/helper.dart'; | 11 import '../serialization/helper.dart'; |
12 | 12 |
13 import 'compile_from_dill_test_helper.dart'; | 13 import 'compile_from_dill_test_helper.dart'; |
14 | 14 |
15 const SOURCE = const { | 15 const SOURCE = const { |
16 'main.dart': ''' | 16 'main.dart': ''' |
17 foo({named}) => 1; | 17 foo({named}) => 1; |
18 bar(a) => !a; | 18 bar(a) => !a; |
19 class Class { | 19 class Class { |
20 var field; | 20 var field; |
21 static var staticField; | 21 static var staticField; |
22 Class(this.field); | 22 |
| 23 Class(); |
| 24 Class.named(this.field); |
| 25 |
| 26 method() {} |
| 27 } |
| 28 |
| 29 class SubClass extends Class { |
| 30 method() { |
| 31 super.method(); |
| 32 } |
23 } | 33 } |
24 main() { | 34 main() { |
25 foo(); | 35 foo(); |
26 bar(true); | 36 bar(true); |
27 []; | 37 []; |
28 {}; | 38 {}; |
29 new Object(); | 39 new Object(); |
30 new Class(''); | 40 new Class.named(''); |
| 41 new SubClass().method(); |
31 Class.staticField; | 42 Class.staticField; |
32 var x = null; | 43 var x = null; |
33 var y1 = x == null; | 44 var y1 = x == null; |
34 var y2 = null == x; | 45 var y2 = null == x; |
35 var z1 = x?.toString(); | 46 var z1 = x?.toString(); |
36 var z2 = x ?? y1; | 47 var z2 = x ?? y1; |
37 var z3 = x ??= y2; | 48 var z3 = x ??= y2; |
38 var w = x == null ? null : x.toString(); | 49 var w = x == null ? null : x.toString(); |
39 for (int i = 0; i < 10; i++) { | 50 for (int i = 0; i < 10; i++) { |
40 if (i == 5) continue; | 51 if (i == 5) continue; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } else { | 86 } else { |
76 entryPoint = Uri.parse('memory:main.dart'); | 87 entryPoint = Uri.parse('memory:main.dart'); |
77 memorySourceFiles = SOURCE; | 88 memorySourceFiles = SOURCE; |
78 } | 89 } |
79 | 90 |
80 return runTest(entryPoint, memorySourceFiles, | 91 return runTest(entryPoint, memorySourceFiles, |
81 verbose: arguments.verbose, | 92 verbose: arguments.verbose, |
82 skipWarnings: skipWarnings, | 93 skipWarnings: skipWarnings, |
83 skipErrors: skipErrors); | 94 skipErrors: skipErrors); |
84 } | 95 } |
OLD | NEW |