| Index: runtime/lib/mirrors_impl.dart
|
| diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
|
| index e977653737ec927ca00664846cd12ad8100d683a..6ffec4be678dcbaa1ead6cef8476bd2fbe8f9e80 100644
|
| --- a/runtime/lib/mirrors_impl.dart
|
| +++ b/runtime/lib/mirrors_impl.dart
|
| @@ -403,9 +403,16 @@ class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl
|
| });
|
| }
|
|
|
| - Future<InstanceMirror> findInContext(Symbol name) {
|
| - throw new UnimplementedError(
|
| - 'ClosureMirror.findInContext() is not implemented');
|
| + InstanceMirror findInContext(Symbol name, {ifAbsent: null}) {
|
| + List<String> parts = _n(name).split(".").toList(growable: false);
|
| + if (parts.length > 3) {
|
| + throw new ArgumentError("Invalid symbol: ${name}");
|
| + }
|
| + var instance = _computeFindInContext(_reflectee, parts);
|
| + if (instance != null) {
|
| + return reflect(instance);
|
| + }
|
| + return ifAbsent == null ? null : ifAbsent();
|
| }
|
|
|
| String toString() => "ClosureMirror on '${Error.safeToString(_reflectee)}'";
|
| @@ -415,6 +422,9 @@ class _LocalClosureMirrorImpl extends _LocalInstanceMirrorImpl
|
|
|
| static _computeFunction(reflectee)
|
| native 'ClosureMirror_function';
|
| +
|
| + static _computeFindInContext(reflectee, name)
|
| + native 'ClosureMirror_find_in_context';
|
| }
|
|
|
| class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
|
|
|