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'; | |
112 writeFile(aPath, 'class A {}'); | 111 writeFile(aPath, 'class A {}'); |
113 Uri bUri = writeFile(bPath, 'export "a.dart";'); | 112 writeFile(bPath, 'export "a.dart";'); |
114 Uri cUri = writeFile(cPath, 'export "b.dart";'); | 113 Uri cUri = writeFile(cPath, r''' |
115 Uri dUri = writeFile(dPath, r''' | 114 import 'b.dart'; |
116 import 'c.dart'; | |
117 A a; | 115 A a; |
118 '''); | 116 '''); |
119 | 117 |
120 KernelResult result = await driver.getKernel(dUri); | 118 KernelResult result = await driver.getKernel(cUri); |
121 Library library = _getLibrary(result, dUri); | 119 Library library = _getLibrary(result, cUri); |
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 '''); | |
136 expect(_getLibraryText(library), r''' | 120 expect(_getLibraryText(library), r''' |
137 library; | 121 library; |
138 import self as self; | 122 import self as self; |
139 import "./a.dart" as a; | 123 import "./a.dart" as a; |
140 | 124 |
141 static field a::A a; | 125 static field a::A a; |
142 '''); | 126 '''); |
143 } | 127 } |
144 | 128 |
145 test_compile_export_cycle() async { | 129 test_compile_export_cycle() async { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 .writeLibraryFile(library); | 768 .writeLibraryFile(library); |
785 return buffer.toString(); | 769 return buffer.toString(); |
786 } | 770 } |
787 | 771 |
788 /// Return the [Uri] for the given Posix [path]. | 772 /// Return the [Uri] for the given Posix [path]. |
789 static Uri _folderUri(String path) { | 773 static Uri _folderUri(String path) { |
790 if (!path.endsWith('/')) path += '/'; | 774 if (!path.endsWith('/')) path += '/'; |
791 return Uri.parse('file://$path'); | 775 return Uri.parse('file://$path'); |
792 } | 776 } |
793 } | 777 } |
OLD | NEW |