OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 of the graph segmentation algorithm used by deferred loading | 5 // Test of the graph segmentation algorithm used by deferred loading |
6 // to determine which elements can be deferred and which libraries | 6 // to determine which elements can be deferred and which libraries |
7 // much be included in the initial download (loaded eagerly). | 7 // much be included in the initial download (loaded eagerly). |
8 | 8 |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
(...skipping 19 matching lines...) Expand all Loading... |
30 // The main library imports lib1 and lib2 deferred and use lib1.foo1 and | 30 // The main library imports lib1 and lib2 deferred and use lib1.foo1 and |
31 // lib2.foo2. This should trigger seperate outputunits for main, lib1 and lib2. | 31 // lib2.foo2. This should trigger seperate outputunits for main, lib1 and lib2. |
32 // | 32 // |
33 // Both lib1 and lib2 import lib3 directly and | 33 // Both lib1 and lib2 import lib3 directly and |
34 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should | 34 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should |
35 // be created. | 35 // be created. |
36 // | 36 // |
37 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2 | 37 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2 |
38 // uses lib4.bar2. So two output units should be created for lib4, one for each | 38 // uses lib4.bar2. So two output units should be created for lib4, one for each |
39 // import. | 39 // import. |
40 const Map MEMORY_SOURCE_FILES = const {"main.dart": """ | 40 const Map MEMORY_SOURCE_FILES = const { |
| 41 "main.dart": """ |
41 import "dart:async"; | 42 import "dart:async"; |
42 | 43 |
43 import 'lib.dart' deferred as lib show f1; | 44 import 'lib.dart' deferred as lib show f1; |
44 import 'lib.dart' show f2; | 45 import 'lib.dart' show f2; |
45 | 46 |
46 void main() { | 47 void main() { |
47 print(f2()); | 48 print(f2()); |
48 lib.loadLibrary().then((_) { | 49 lib.loadLibrary().then((_) { |
49 print(lib.f1()); | 50 print(lib.f1()); |
50 }); | 51 }); |
51 } | 52 } |
52 """, "lib.dart": """ | 53 """, |
| 54 "lib.dart": """ |
53 int f1 () { | 55 int f1 () { |
54 return 1; | 56 return 1; |
55 } | 57 } |
56 | 58 |
57 int f2 () { | 59 int f2 () { |
58 return 2; | 60 return 2; |
59 } | 61 } |
60 """,}; | 62 """, |
| 63 }; |
OLD | NEW |