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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:front_end/compiler_options.dart'; | 7 import 'package:front_end/compiler_options.dart'; |
8 import 'package:front_end/memory_file_system.dart'; | 8 import 'package:front_end/memory_file_system.dart'; |
9 import 'package:front_end/src/base/performace_logger.dart'; | 9 import 'package:front_end/src/base/performace_logger.dart'; |
10 import 'package:front_end/src/base/processed_options.dart'; | 10 import 'package:front_end/src/base/processed_options.dart'; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static method main() → void {} | 101 static method main() → void {} |
102 '''); | 102 '''); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 test_compile_export() async { | 106 test_compile_export() async { |
107 writeFile('/test/.packages', 'test:lib/'); | 107 writeFile('/test/.packages', 'test:lib/'); |
108 String aPath = '/test/lib/a.dart'; | 108 String aPath = '/test/lib/a.dart'; |
109 String bPath = '/test/lib/b.dart'; | 109 String bPath = '/test/lib/b.dart'; |
110 String cPath = '/test/lib/c.dart'; | 110 String cPath = '/test/lib/c.dart'; |
| 111 String dPath = '/test/lib/d.dart'; |
111 writeFile(aPath, 'class A {}'); | 112 writeFile(aPath, 'class A {}'); |
112 writeFile(bPath, 'export "a.dart";'); | 113 Uri bUri = writeFile(bPath, 'export "a.dart";'); |
113 Uri cUri = writeFile(cPath, r''' | 114 Uri cUri = writeFile(cPath, 'export "b.dart";'); |
114 import 'b.dart'; | 115 Uri dUri = writeFile(dPath, r''' |
| 116 import 'c.dart'; |
115 A a; | 117 A a; |
116 '''); | 118 '''); |
117 | 119 |
118 KernelResult result = await driver.getKernel(cUri); | 120 KernelResult result = await driver.getKernel(dUri); |
119 Library library = _getLibrary(result, cUri); | 121 Library library = _getLibrary(result, dUri); |
| 122 expect(_getLibraryText(_getLibrary(result, bUri)), r''' |
| 123 library; |
| 124 import self as self; |
| 125 import "./a.dart" as a; |
| 126 additionalExports = (a::A) |
| 127 |
| 128 '''); |
| 129 expect(_getLibraryText(_getLibrary(result, cUri)), r''' |
| 130 library; |
| 131 import self as self; |
| 132 import "./a.dart" as a; |
| 133 additionalExports = (a::A) |
| 134 |
| 135 '''); |
120 expect(_getLibraryText(library), r''' | 136 expect(_getLibraryText(library), r''' |
121 library; | 137 library; |
122 import self as self; | 138 import self as self; |
123 import "./a.dart" as a; | 139 import "./a.dart" as a; |
124 | 140 |
125 static field a::A a; | 141 static field a::A a; |
126 '''); | 142 '''); |
127 } | 143 } |
128 | 144 |
129 test_compile_export_cycle() async { | 145 test_compile_export_cycle() async { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 .writeLibraryFile(library); | 784 .writeLibraryFile(library); |
769 return buffer.toString(); | 785 return buffer.toString(); |
770 } | 786 } |
771 | 787 |
772 /// Return the [Uri] for the given Posix [path]. | 788 /// Return the [Uri] for the given Posix [path]. |
773 static Uri _folderUri(String path) { | 789 static Uri _folderUri(String path) { |
774 if (!path.endsWith('/')) path += '/'; | 790 if (!path.endsWith('/')) path += '/'; |
775 return Uri.parse('file://$path'); | 791 return Uri.parse('file://$path'); |
776 } | 792 } |
777 } | 793 } |
OLD | NEW |