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

Side by Side Diff: sdk/lib/mirrors/mirrors.dart

Issue 1095903002: Deal with deferred loading in the VM mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // For the purposes of the mirrors library, we adopt a naming 5 // For the purposes of the mirrors library, we adopt a naming
6 // convention with respect to getters and setters. Specifically, for 6 // convention with respect to getters and setters. Specifically, for
7 // some variable or field... 7 // some variable or field...
8 // 8 //
9 // var myField; 9 // var myField;
10 // 10 //
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * 48 *
49 * ## Status: Unstable 49 * ## Status: Unstable
50 * 50 *
51 * The dart:mirrors library is unstable and its API might change slightly as a 51 * The dart:mirrors library is unstable and its API might change slightly as a
52 * result of user feedback. This library is platform dependent and therefore it 52 * result of user feedback. This library is platform dependent and therefore it
53 * has implementations for both dart2js and the Dart VM. Both are under 53 * has implementations for both dart2js and the Dart VM. Both are under
54 * development and may not support all operations yet. 54 * development and may not support all operations yet.
55 */ 55 */
56 library dart.mirrors; 56 library dart.mirrors;
57 57
58 import 'dart:async' show Future;
59
58 /** 60 /**
59 * A [MirrorSystem] is the main interface used to reflect on a set of 61 * A [MirrorSystem] is the main interface used to reflect on a set of
60 * associated libraries. 62 * associated libraries.
61 * 63 *
62 * At runtime each running isolate has a distinct [MirrorSystem]. 64 * At runtime each running isolate has a distinct [MirrorSystem].
63 * 65 *
64 * It is also possible to have a [MirrorSystem] which represents a set 66 * It is also possible to have a [MirrorSystem] which represents a set
65 * of libraries which are not running -- perhaps at compile-time. In 67 * of libraries which are not running -- perhaps at compile-time. In
66 * this case, all available reflective functionality would be 68 * this case, all available reflective functionality would be
67 * supported, but runtime functionality (such as invoking a function 69 * supported, but runtime functionality (such as invoking a function
68 * or inspecting the contents of a variable) would fail dynamically. 70 * or inspecting the contents of a variable) would fail dynamically.
69 */ 71 */
70 abstract class MirrorSystem { 72 abstract class MirrorSystem {
71 /** 73 /**
72 * Returns an immutable map from URIs to mirrors for all 74 * Returns an immutable map from URIs to mirrors for all
73 * libraries known to this mirror system. 75 * libraries known to this mirror system.
74 */ 76 */
75 Map<Uri, LibraryMirror> get libraries; 77 Map<Uri, LibraryMirror> get libraries;
siva 2015/04/22 17:28:00 There is a subtle difference here now, the documen
rmacnak 2015/04/22 18:05:44 I think some of the vagueness here is to allow for
76 78
77 /** 79 /**
78 * Returns the unique library named [libraryName] if it exists. 80 * Returns the unique library named [libraryName] if it exists.
79 * 81 *
80 * If no unique library exists, an error is thrown. 82 * If no unique library exists, an error is thrown.
81 */ 83 */
82 LibraryMirror findLibrary(Symbol libraryName) { 84 LibraryMirror findLibrary(Symbol libraryName) {
83 return libraries.values.singleWhere( 85 return libraries.values.singleWhere(
84 (library) => library.simpleName == libraryName); 86 (library) => library.simpleName == libraryName);
85 } 87 }
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 bool get isExport; 607 bool get isExport;
606 608
607 /// Returns true iff this dependency is a deferred import. Otherwise returns 609 /// Returns true iff this dependency is a deferred import. Otherwise returns
608 /// false. 610 /// false.
609 bool get isDeferred; 611 bool get isDeferred;
610 612
611 /// Returns the library mirror of the library that imports or exports the 613 /// Returns the library mirror of the library that imports or exports the
612 /// [targetLibrary]. 614 /// [targetLibrary].
613 LibraryMirror get sourceLibrary; 615 LibraryMirror get sourceLibrary;
614 616
615 /// Returns the library mirror of the library that is imported or exported. 617 /// Returns the library mirror of the library that is imported or exported,
618 /// or null if the library is not loaded.
616 LibraryMirror get targetLibrary; 619 LibraryMirror get targetLibrary;
617 620
618 /// Returns the prefix if this is a prefixed import and `null` otherwise. 621 /// Returns the prefix if this is a prefixed import and `null` otherwise.
619 Symbol get prefix; 622 Symbol get prefix;
620 623
621 /// Returns the list of show/hide combinators on the import/export 624 /// Returns the list of show/hide combinators on the import/export
622 /// declaration. 625 /// declaration.
623 List<CombinatorMirror> get combinators; 626 List<CombinatorMirror> get combinators;
624 627
625 /// Returns the source location for this import/export declaration. 628 /// Returns the source location for this import/export declaration.
626 SourceLocation get location; 629 SourceLocation get location;
627 630
628 List<InstanceMirror> get metadata; 631 List<InstanceMirror> get metadata;
632
633 /// Returns a future that completes with a library mirror on the library being
634 /// imported or exported when it is loaded, and initiates a load of that
635 /// library if it is not loaded.
636 Future<LibraryMirror> loadLibrary();
629 } 637 }
630 638
631 /// A mirror on a show/hide combinator declared on a library dependency. 639 /// A mirror on a show/hide combinator declared on a library dependency.
632 abstract class CombinatorMirror implements Mirror { 640 abstract class CombinatorMirror implements Mirror {
633 /// The list of identifiers on the combinator. 641 /// The list of identifiers on the combinator.
634 List<Symbol> get identifiers; 642 List<Symbol> get identifiers;
635 643
636 /// Is `true` if this is a 'show' combinator. 644 /// Is `true` if this is a 'show' combinator.
637 bool get isShow; 645 bool get isShow;
638 646
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 * 1269 *
1262 * When used as metadata on an import of "dart:mirrors", this metadata does 1270 * When used as metadata on an import of "dart:mirrors", this metadata does
1263 * not apply to the library in which the annotation is used, but instead 1271 * not apply to the library in which the annotation is used, but instead
1264 * applies to the other libraries (all libraries if "*" is used). 1272 * applies to the other libraries (all libraries if "*" is used).
1265 */ 1273 */
1266 final override; 1274 final override;
1267 1275
1268 const MirrorsUsed( 1276 const MirrorsUsed(
1269 {this.symbols, this.targets, this.metaTargets, this.override}); 1277 {this.symbols, this.targets, this.metaTargets, this.override});
1270 } 1278 }
OLDNEW
« runtime/lib/mirrors.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698