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

Side by Side Diff: lib/dartdoc/mirrors/dart2js_mirror.dart

Issue 10830303: Refactor Library/CompilationUnit and how we define local Scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix reference in dart2js_mirror.dart Created 8 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 | Annotate | Revision Log
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 #library('mirrors.dart2js'); 5 #library('mirrors.dart2js');
6 6
7 #import('../../compiler/compiler.dart', prefix: 'diagnostics'); 7 #import('../../compiler/compiler.dart', prefix: 'diagnostics');
8 #import('../../compiler/implementation/elements/elements.dart'); 8 #import('../../compiler/implementation/elements/elements.dart');
9 #import('../../compiler/implementation/apiimpl.dart', prefix: 'api'); 9 #import('../../compiler/implementation/apiimpl.dart', prefix: 'api');
10 #import('../../compiler/implementation/scanner/scannerlib.dart'); 10 #import('../../compiler/implementation/scanner/scannerlib.dart');
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 log('Resolving...'); 229 log('Resolving...');
230 phase = Compiler.PHASE_RESOLVING; 230 phase = Compiler.PHASE_RESOLVING;
231 backend.enqueueHelpers(enqueuer.resolution); 231 backend.enqueueHelpers(enqueuer.resolution);
232 processQueueList(enqueuer.resolution, elementList); 232 processQueueList(enqueuer.resolution, elementList);
233 log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.'); 233 log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.');
234 } 234 }
235 235
236 void processQueueList(Enqueuer world, List<LibraryElement> elements) { 236 void processQueueList(Enqueuer world, List<LibraryElement> elements) {
237 backend.processNativeClasses(world, libraries.getValues()); 237 backend.processNativeClasses(world, libraries.getValues());
238 for (var library in elements) { 238 for (var library in elements) {
239 library.elements.forEach((_, element) { 239 library.localMembers.forEach((element) {
ahe 2012/08/14 12:45:26 I like this better than the old version.
240 world.addToWorkList(element); 240 world.addToWorkList(element);
241 }); 241 });
242 } 242 }
243 progress.reset(); 243 progress.reset();
244 world.forEach((WorkItem work) { 244 world.forEach((WorkItem work) {
245 withCurrentElement(work.element, () => work.run(this, world)); 245 withCurrentElement(work.element, () => work.run(this, world));
246 }); 246 });
247 //world.queueIsClosed = true; 247 //world.queueIsClosed = true;
248 assert(world.checkNoEnqueuedInvokedInstanceMethods()); 248 assert(world.checkNoEnqueuedInvokedInstanceMethods());
249 world.registerFieldClosureInvocations(); 249 world.registerFieldClosureInvocations();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 /** 479 /**
480 * Returns the library name (for libraries with a #library tag) or the script 480 * Returns the library name (for libraries with a #library tag) or the script
481 * file name (for scripts without a #library tag). The latter case is used to 481 * file name (for scripts without a #library tag). The latter case is used to
482 * provide a 'library name' for scripts, to use for instance in dartdoc. 482 * provide a 'library name' for scripts, to use for instance in dartdoc.
483 */ 483 */
484 String get simpleName() { 484 String get simpleName() {
485 if (_library.libraryTag !== null) { 485 if (_library.libraryTag !== null) {
486 return _library.libraryTag.argument.dartString.slowToString(); 486 return _library.libraryTag.argument.dartString.slowToString();
487 } else { 487 } else {
488 // Use the file name as script name. 488 // Use the file name as script name.
489 String path = _library.script.uri.path; 489 String path = _library.uri.path;
ahe 2012/08/14 12:45:26 Also better, I think.
490 return path.substring(path.lastIndexOf('/') + 1); 490 return path.substring(path.lastIndexOf('/') + 1);
491 } 491 }
492 } 492 }
493 493
494 String get qualifiedName() => simpleName; 494 String get qualifiedName() => simpleName;
495 495
496 void _ensureTypes() { 496 void _ensureTypes() {
497 if (_types == null) { 497 if (_types == null) {
498 _types = <InterfaceMirror>{}; 498 _types = <InterfaceMirror>{};
499 _library.forEachExport((Element e) { 499 _library.forEachExport((Element e) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 var span = system.compiler.spanFromNode(node, script.uri); 677 var span = system.compiler.spanFromNode(node, script.uri);
678 return new Dart2JsLocation(script, span); 678 return new Dart2JsLocation(script, span);
679 } 679 }
680 } 680 }
681 return super.location; 681 return super.location;
682 } 682 }
683 683
684 void _ensureMembers() { 684 void _ensureMembers() {
685 if (_members == null) { 685 if (_members == null) {
686 _members = <Dart2JsMemberMirror>{}; 686 _members = <Dart2JsMemberMirror>{};
687 _class.constructors.forEach((_, e) { 687 _class.localMembers.forEach((e) {
688 for (var member in _convertElementMemberToMemberMirrors(this, e)) { 688 for (var member in _convertElementMemberToMemberMirrors(this, e)) {
689 _members[member.canonicalName] = member; 689 _members[member.canonicalName] = member;
690 } 690 }
691 });
692 _class.localMembers.forEach((_, e) {
693 for (var member in _convertElementMemberToMemberMirrors(this, e)) {
694 _members[member.canonicalName] = member;
695 }
696 }); 691 });
697 } 692 }
698 } 693 }
699 694
700 Map<Object, MemberMirror> get declaredMembers() { 695 Map<Object, MemberMirror> get declaredMembers() {
701 _ensureMembers(); 696 _ensureMembers();
702 return new ImmutableMapWrapper<Object, MemberMirror>(_members); 697 return new ImmutableMapWrapper<Object, MemberMirror>(_members);
703 } 698 }
704 699
705 bool get isObject() => _class == system.compiler.objectClass; 700 bool get isObject() => _class == system.compiler.objectClass;
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 if (node !== null) { 1355 if (node !== null) {
1361 var span = system.compiler.spanFromNode(node, script.uri); 1356 var span = system.compiler.spanFromNode(node, script.uri);
1362 return new Dart2JsLocation(script, span); 1357 return new Dart2JsLocation(script, span);
1363 } else { 1358 } else {
1364 var span = system.compiler.spanFromElement(_variable); 1359 var span = system.compiler.spanFromElement(_variable);
1365 return new Dart2JsLocation(script, span); 1360 return new Dart2JsLocation(script, span);
1366 } 1361 }
1367 } 1362 }
1368 } 1363 }
1369 1364
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698