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

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

Issue 10832203: Refactor Library/CompilationUnit and how we define local Scope. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Last test fixes, passes co19. 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 468 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 simpleName() { 484 String 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;
490 return path.substring(path.lastIndexOf('/') + 1); 490 return path.substring(path.lastIndexOf('/') + 1);
491 } 491 }
492 } 492 }
493 493
494 String qualifiedName() => simpleName(); 494 String 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 var span = system.compiler.spanFromNode(node, script.uri); 675 var span = system.compiler.spanFromNode(node, script.uri);
676 return new Dart2JsLocation(script, span); 676 return new Dart2JsLocation(script, span);
677 } 677 }
678 } 678 }
679 return super.location(); 679 return super.location();
680 } 680 }
681 681
682 void _ensureMembers() { 682 void _ensureMembers() {
683 if (_members == null) { 683 if (_members == null) {
684 _members = <Dart2JsMemberMirror>{}; 684 _members = <Dart2JsMemberMirror>{};
685 _class.constructors.forEach((_, e) { 685 _class.localMembers.forEach((e) {
686 for (var member in _convertElementMemberToMemberMirrors(this, e)) { 686 for (var member in _convertElementMemberToMemberMirrors(this, e)) {
687 _members[member.canonicalName] = member; 687 _members[member.canonicalName] = member;
688 } 688 }
689 });
690 _class.localMembers.forEach((_, e) {
691 for (var member in _convertElementMemberToMemberMirrors(this, e)) {
692 _members[member.canonicalName] = member;
693 }
694 }); 689 });
695 } 690 }
696 } 691 }
697 692
698 Map<Object, MemberMirror> declaredMembers() { 693 Map<Object, MemberMirror> declaredMembers() {
699 _ensureMembers(); 694 _ensureMembers();
700 return new ImmutableMapWrapper<Object, MemberMirror>(_members); 695 return new ImmutableMapWrapper<Object, MemberMirror>(_members);
701 } 696 }
702 697
703 LibraryMirror library() { 698 LibraryMirror library() {
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 if (node !== null) { 1357 if (node !== null) {
1363 var span = system.compiler.spanFromNode(node, script.uri); 1358 var span = system.compiler.spanFromNode(node, script.uri);
1364 return new Dart2JsLocation(script, span); 1359 return new Dart2JsLocation(script, span);
1365 } else { 1360 } else {
1366 var span = system.compiler.spanFromElement(_variable); 1361 var span = system.compiler.spanFromElement(_variable);
1367 return new Dart2JsLocation(script, span); 1362 return new Dart2JsLocation(script, span);
1368 } 1363 }
1369 } 1364 }
1370 } 1365 }
1371 1366
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698