Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_loader.dart

Issue 2991753002: Add export dependencies to Kernel libraries and use them to resynthesize ExportElement(s) in Analyz… (Closed)
Patch Set: Extract exportedLibrary. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library fasta.source_loader; 5 library fasta.source_loader;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:typed_data' show Uint8List; 9 import 'dart:typed_data' show Uint8List;
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 exporters.add(exporter.exporter); 210 exporters.add(exporter.exporter);
211 } 211 }
212 } 212 }
213 }); 213 });
214 Set<SourceLibraryBuilder> both = new Set<SourceLibraryBuilder>(); 214 Set<SourceLibraryBuilder> both = new Set<SourceLibraryBuilder>();
215 for (LibraryBuilder exported in exportees) { 215 for (LibraryBuilder exported in exportees) {
216 if (exporters.contains(exported)) { 216 if (exporters.contains(exported)) {
217 both.add(exported); 217 both.add(exported);
218 } 218 }
219 for (Export export in exported.exporters) { 219 for (Export export in exported.exporters) {
220 exported.exports.forEach(export.addToExportScope); 220 exported.exportScope.forEach(export.addToExportScope);
221 } 221 }
222 } 222 }
223 bool wasChanged = false; 223 bool wasChanged = false;
224 do { 224 do {
225 wasChanged = false; 225 wasChanged = false;
226 for (SourceLibraryBuilder exported in both) { 226 for (SourceLibraryBuilder exported in both) {
227 for (Export export in exported.exporters) { 227 for (Export export in exported.exporters) {
228 SourceLibraryBuilder exporter = export.exporter; 228 SourceLibraryBuilder exporter = export.exporter;
229 exported.exports.forEach((String name, Builder member) { 229 exported.exportScope.forEach((String name, Builder member) {
230 if (exporter.addToExportScope(name, member)) { 230 if (exporter.addToExportScope(name, member)) {
231 wasChanged = true; 231 wasChanged = true;
232 } 232 }
233 }); 233 });
234 } 234 }
235 } 235 }
236 } while (wasChanged); 236 } while (wasChanged);
237 builders.forEach((Uri uri, LibraryBuilder library) { 237 builders.forEach((Uri uri, LibraryBuilder library) {
238 if (library is SourceLibraryBuilder) { 238 if (library is SourceLibraryBuilder) {
239 library.addImportsToScope(); 239 library.addImportsToScope();
240 } 240 }
241 }); 241 });
242 ticker.logMs("Computed library scopes"); 242 ticker.logMs("Computed library scopes");
243 // debugPrintExports(); 243 // debugPrintExports();
244 } 244 }
245 245
246 void debugPrintExports() { 246 void debugPrintExports() {
247 // TODO(sigmund): should be `covarint SourceLibraryBuilder`. 247 // TODO(sigmund): should be `covarint SourceLibraryBuilder`.
248 builders.forEach((Uri uri, dynamic l) { 248 builders.forEach((Uri uri, dynamic l) {
249 SourceLibraryBuilder library = l; 249 SourceLibraryBuilder library = l;
250 Set<Builder> members = new Set<Builder>(); 250 Set<Builder> members = new Set<Builder>();
251 library.forEach((String name, Builder member) { 251 library.forEach((String name, Builder member) {
252 while (member != null) { 252 while (member != null) {
253 members.add(member); 253 members.add(member);
254 member = member.next; 254 member = member.next;
255 } 255 }
256 }); 256 });
257 List<String> exports = <String>[]; 257 List<String> exports = <String>[];
258 library.exports.forEach((String name, Builder member) { 258 library.exportScope.forEach((String name, Builder member) {
259 while (member != null) { 259 while (member != null) {
260 if (!members.contains(member)) { 260 if (!members.contains(member)) {
261 exports.add(name); 261 exports.add(name);
262 } 262 }
263 member = member.next; 263 member = member.next;
264 } 264 }
265 }); 265 });
266 if (exports.isNotEmpty) { 266 if (exports.isNotEmpty) {
267 print("$uri exports $exports"); 267 print("$uri exports $exports");
268 } 268 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 Expression throwCompileConstantError(Expression error) { 533 Expression throwCompileConstantError(Expression error) {
534 return target.backendTarget.throwCompileConstantError(coreTypes, error); 534 return target.backendTarget.throwCompileConstantError(coreTypes, error);
535 } 535 }
536 536
537 Expression buildCompileTimeError(Message message, int offset, Uri uri) { 537 Expression buildCompileTimeError(Message message, int offset, Uri uri) {
538 String text = target.context 538 String text = target.context
539 .format(message.withLocation(uri, offset), Severity.error); 539 .format(message.withLocation(uri, offset), Severity.error);
540 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset); 540 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset);
541 } 541 }
542 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698