| OLD | NEW |
| 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 Loading... |
| 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; |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |