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

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: rebase 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') | no next file with comments »
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 8ae0e48ebddda3f36b530a17f8f8701b0e078403..3cc7cac603d393f3e619b206cd93f474c66fb924 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) {
@@ -913,6 +924,7 @@ class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl
}
bool get isPrivate => false;
+ bool get isStatic => false;
final bool isTopLevel = false;
@@ -1100,6 +1112,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) {
@@ -1265,7 +1284,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698