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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 36023003: Add LibraryMirror.declarations and ClassMirror.declarations to the API and both implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | sdk/lib/mirrors/mirrors.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index e7cc90e2fd5edbe3e092b09c982095076b0f5862..bd47cf464de66d95d9b2cd6930ffdcd9133de2f8 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -593,6 +593,17 @@ class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
return _mixin;
}
+ Map<Symbol, DeclarationMirror> _declarations;
+ Map<Symbol, DeclarationMirror> get declarations {
+ if (_declarations != null) return _declarations;
+ var decls = new Map<Symbol, DeclarationMirror>();
+ decls.addAll(members);
+ decls.addAll(constructors);
+ typeVariables.forEach((tv) => decls[tv.simpleName] = tv);
+ return _declarations =
+ new _UnmodifiableMapView<Symbol, DeclarationMirror>(decls);
+ }
+
Map<Symbol, Mirror> _members;
Map<Symbol, Mirror> get members {
if (_members == null) {
@@ -912,6 +923,7 @@ class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl
}
bool get isPrivate => false;
+ bool get isStatic => true;
final bool isTopLevel = false;
@@ -1098,6 +1110,13 @@ class _LocalLibraryMirrorImpl extends _LocalObjectMirrorImpl
final Uri uri;
+ Map<Symbol, DeclarationMirror> _declarations;
+ Map<Symbol, DeclarationMirror> get declarations {
+ if (_declarations != null) return _declarations;
+ return _declarations =
+ new _UnmodifiableMapView<Symbol, DeclarationMirror>(members);
+ }
+
Map<Symbol, Mirror> _members;
Map<Symbol, Mirror> get members {
if (_members == null) {
@@ -1263,7 +1282,7 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
if (!isConstructor) {
_constructorName = _s('');
} else {
- var parts = _n(simpleName).split('.');
+ var parts = MirrorSystem.getName(simpleName).split('.');
if (parts.length > 2) {
throw new MirrorException(
'Internal error in MethodMirror.constructorName: '
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | sdk/lib/mirrors/mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698