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

Side by Side Diff: frog/world.dart

Issue 9656003: Fix for issue with incorrectly renamed private names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: x Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « frog/minfrog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** The one true [World]. */ 5 /** The one true [World]. */
6 World world; 6 World world;
7 7
8 /** 8 /**
9 * Experimental phase to enable await, only set when using the 9 * Experimental phase to enable await, only set when using the
10 * await/awaitc.dart entrypoint. 10 * await/awaitc.dart entrypoint.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if (!res && options.legOnly) { 403 if (!res && options.legOnly) {
404 fatal("Leg could not compile ${options.dartScript}"); 404 fatal("Leg could not compile ${options.dartScript}");
405 return true; // In --leg_only, always "handle" the compilation. 405 return true; // In --leg_only, always "handle" the compilation.
406 } 406 }
407 return res; 407 return res;
408 } 408 }
409 409
410 void runCompilationPhases() { 410 void runCompilationPhases() {
411 final lib = withTiming('first pass', () => processDartScript()); 411 final lib = withTiming('first pass', () => processDartScript());
412 withTiming('resolve top level', resolveAll); 412 withTiming('resolve top level', resolveAll);
413 withTiming('privatization', () { makePrivateMembersUnique(lib); });
413 if (experimentalAwaitPhase != null) { 414 if (experimentalAwaitPhase != null) {
414 withTiming('await translation', experimentalAwaitPhase); 415 withTiming('await translation', experimentalAwaitPhase);
415 } 416 }
416 withTiming('analyze pass', () { analyzeCode(lib); }); 417 withTiming('analyze pass', () { analyzeCode(lib); });
417 if (options.checkOnly) return; 418 if (options.checkOnly) return;
418 419
419 withTiming('generate code', () { generateCode(lib); }); 420 withTiming('generate code', () { generateCode(lib); });
420 } 421 }
421 422
422 String getGeneratedCode() { 423 String getGeneratedCode() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 482
482 resolveAll() { 483 resolveAll() {
483 for (var lib in libraries.getValues()) { 484 for (var lib in libraries.getValues()) {
484 lib.resolve(); 485 lib.resolve();
485 } 486 }
486 for (var lib in libraries.getValues()) { 487 for (var lib in libraries.getValues()) {
487 lib.postResolveChecks(); 488 lib.postResolveChecks();
488 } 489 }
489 } 490 }
490 491
492 makePrivateMembersUnique(Library rootLib) {
493 var usedNames = new Set<String>();
494 process(lib) {
495 for (var name in lib._privateMembers.getKeys()) {
496 if (usedNames.contains(name)) {
497 var members = lib._privateMembers[name];
498 String uniqueName = '_${lib.jsname}${members.jsname}';
499 members.jsname = uniqueName;
500 for (var member in members.members) {
501 member._jsname = uniqueName;
502 }
503 } else {
504 usedNames.add(name);
505 }
506 }
507 }
508
509 // Visit libraries in pre-order of imports.
510 var visited = new Set<Library>();
511 visit(lib) {
512 if (visited.contains(lib)) return;
513 visited.add(lib);
514 process(lib);
515 for (var import in lib.imports) {
516 visit(import.library);
517 }
518 }
519 visit(rootLib);
520 }
521
491 findMainMethod(Library lib) { 522 findMainMethod(Library lib) {
492 var main = lib.lookup('main', lib.span); 523 var main = lib.lookup('main', lib.span);
493 if (main == null) { 524 if (main == null) {
494 if (!options.checkOnly) fatal('no main method specified'); 525 if (!options.checkOnly) fatal('no main method specified');
495 } 526 }
496 return main; 527 return main;
497 } 528 }
498 529
499 /** 530 /**
500 * Walks all code in lib and imports for analysis. 531 * Walks all code in lib and imports for analysis.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 659
629 withTiming(String name, f()) { 660 withTiming(String name, f()) {
630 final sw = new Stopwatch(); 661 final sw = new Stopwatch();
631 sw.start(); 662 sw.start();
632 var result = f(); 663 var result = f();
633 sw.stop(); 664 sw.stop();
634 info('$name in ${sw.elapsedInMs()}msec'); 665 info('$name in ${sw.elapsedInMs()}msec');
635 return result; 666 return result;
636 } 667 }
637 } 668 }
OLDNEW
« no previous file with comments | « frog/minfrog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698