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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 105163002: Remove implementation of deprecated mirror API from the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | tests/lib/lib.status » ('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 8476c15fcc085852aadc4c3d416162c7aec1b54d..ec24d3e13cab5d4c2aa275dca1c119eabd54468e 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -248,7 +248,7 @@ class _LocalInstanceMirror extends _LocalObjectMirror
Function operator [](Symbol selector) {
bool found = false;
for (ClassMirror c = type; c != null; c = c.superclass) {
- var target = c.methods[selector];
+ var target = c._methods[selector];
if (target != null && !target.isStatic && target.isRegularMethod) {
found = true;
break;
@@ -337,14 +337,6 @@ class _LocalClosureMirror extends _LocalInstanceMirror
return reflect(_apply(arguments, names));
}
- Future<InstanceMirror> applyAsync(List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]) {
- return new Future(() {
- return this.apply(_unwrapAsyncPositionals(positionalArguments),
- _unwrapAsyncNamed(namedArguments));
- });
- }
-
InstanceMirror findInContext(Symbol name, {ifAbsent: null}) {
List<String> parts = _n(name).split(".").toList(growable: false);
if (parts.length > 3) {
@@ -504,71 +496,41 @@ class _LocalClassMirror extends _LocalObjectMirror
Map<Symbol, DeclarationMirror> get declarations {
if (_declarations != null) return _declarations;
var decls = new Map<Symbol, DeclarationMirror>();
- decls.addAll(members);
- decls.addAll(constructors);
+ 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) {
+ Map<Symbol, Mirror> _cachedMembers;
+ Map<Symbol, Mirror> get _members {
+ if (_cachedMembers == null) {
var whoseMembers = _isMixinAlias ? _trueSuperclass : this;
- _members = _makeMemberMap(mixin._computeMembers(whoseMembers._reflectee));
+ _cachedMembers = _makeMemberMap(mixin._computeMembers(whoseMembers._reflectee));
}
- return _members;
+ return _cachedMembers;
}
- Map<Symbol, MethodMirror> _methods;
- Map<Symbol, MethodMirror> get methods {
- if (_methods == null) {
- _methods = _filterMap(
- members,
+ Map<Symbol, MethodMirror> _cachedMethods;
+ Map<Symbol, MethodMirror> get _methods {
+ if (_cachedMethods == null) {
+ _cachedMethods = _filterMap(
+ _members,
(key, value) => (value is MethodMirror && value.isRegularMethod));
}
- return _methods;
- }
-
- Map<Symbol, MethodMirror> _getters;
- Map<Symbol, MethodMirror> get getters {
- if (_getters == null) {
- _getters = _filterMap(
- members,
- (key, value) => (value is MethodMirror && value.isGetter));
- }
- return _getters;
- }
-
- Map<Symbol, MethodMirror> _setters;
- Map<Symbol, MethodMirror> get setters {
- if (_setters == null) {
- _setters = _filterMap(
- members,
- (key, value) => (value is MethodMirror && value.isSetter));
- }
- return _setters;
- }
-
- Map<Symbol, VariableMirror> _variables;
- Map<Symbol, VariableMirror> get variables {
- if (_variables == null) {
- _variables = _filterMap(
- members,
- (key, value) => (value is VariableMirror));
- }
- return _variables;
+ return _cachedMethods;
}
- Map<Symbol, MethodMirror> _constructors;
- Map<Symbol, MethodMirror> get constructors {
- if (_constructors == null) {
+ Map<Symbol, MethodMirror> _cachedConstructors;
+ Map<Symbol, MethodMirror> get _constructors {
+ if (_cachedConstructors == null) {
var constructorsList = _computeConstructors(_reflectee);
var stringName = _n(simpleName);
constructorsList.forEach((c) => c._patchConstructorName(stringName));
- _constructors = _makeMemberMap(constructorsList);
+ _cachedConstructors = _makeMemberMap(constructorsList);
}
- return _constructors;
+ return _cachedConstructors;
}
bool get _isAnonymousMixinApplication {
@@ -622,7 +584,7 @@ class _LocalClassMirror extends _LocalObjectMirror
String toString() => "ClassMirror on '${MirrorSystem.getName(simpleName)}'";
Function operator [](Symbol selector) {
- var target = methods[selector];
+ var target = _methods[selector];
if (target == null || !target.isStatic || !target.isRegularMethod) {
throw new ArgumentError(
"${MirrorSystem.getName(simpleName)} has no static method "
@@ -658,16 +620,6 @@ class _LocalClassMirror extends _LocalObjectMirror
names));
}
- Future<InstanceMirror> newInstanceAsync(Symbol constructorName,
- List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]) {
- return new Future(() {
- return this.newInstance(constructorName,
- _unwrapAsyncPositionals(positionalArguments),
- _unwrapAsyncNamed(namedArguments));
- });
- }
-
List<InstanceMirror> get metadata {
// Get the metadata objects, convert them into InstanceMirrors using
// reflect() and then make them into a Dart list.
@@ -996,64 +948,23 @@ class _LocalLibraryMirror extends _LocalObjectMirror
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) {
- _members = _makeMemberMap(_computeMembers(_reflectee));
- }
- return _members;
- }
-
- Map<Symbol, ClassMirror> _types;
- Map<Symbol, TypeMirror> get types {
- if (_types == null) {
- _types = _filterMap(members, (key, value) => (value is TypeMirror));
- }
- return _types;
- }
-
- Map<Symbol, ClassMirror> _classes;
- Map<Symbol, ClassMirror> get classes {
- if (_classes == null) {
- _classes = _filterMap(members, (key, value) => (value is ClassMirror));
- }
- return _classes;
- }
-
- Map<Symbol, MethodMirror> _functions;
- Map<Symbol, MethodMirror> get functions {
- if (_functions == null) {
- _functions = _filterMap(members, (key, value) => (value is MethodMirror));
- }
- return _functions;
- }
-
- Map<Symbol, MethodMirror> _getters;
- Map<Symbol, MethodMirror> get getters {
- if (_getters == null) {
- _getters = _filterMap(functions, (key, value) => (value.isGetter));
- }
- return _getters;
+ new _UnmodifiableMapView<Symbol, DeclarationMirror>(_members);
}
- Map<Symbol, MethodMirror> _setters;
- Map<Symbol, MethodMirror> get setters {
- if (_setters == null) {
- _setters = _filterMap(functions, (key, value) => (value.isSetter));
+ Map<Symbol, Mirror> _cachedMembers;
+ Map<Symbol, Mirror> get _members {
+ if (_cachedMembers == null) {
+ _cachedMembers = _makeMemberMap(_computeMembers(_reflectee));
}
- return _setters;
+ return _cachedMembers;
}
- Map<Symbol, VariableMirror> _variables;
- Map<Symbol, VariableMirror> get variables {
- if (_variables == null) {
- _variables = _filterMap(members,
- (key, value) => (value is VariableMirror));
+ Map<Symbol, MethodMirror> _cachedFunctions;
+ Map<Symbol, MethodMirror> get _functions {
+ if (_cachedFunctions == null) {
+ _cachedFunctions = _filterMap(_members, (key, value) => (value is MethodMirror));
}
- return _variables;
+ return _cachedFunctions;
}
List<InstanceMirror> get metadata {
@@ -1072,7 +983,7 @@ class _LocalLibraryMirror extends _LocalObjectMirror
String toString() => "LibraryMirror on '${_n(simpleName)}'";
Function operator [](Symbol selector) {
- var target = functions[selector];
+ var target = _functions[selector];
if (target == null || !target.isRegularMethod) {
throw new ArgumentError(
"${MirrorSystem.getName(simpleName)} has no top-level method "
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698