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

Side by Side Diff: runtime/lib/mirrors_impl.dart

Issue 52953002: Hide ClosureMirror.findInContext behind a flag for 1.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 1 month 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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // VM-specific implementation of the dart:mirrors library. 5 // VM-specific implementation of the dart:mirrors library.
6 6
7 import "dart:collection"; 7 import "dart:collection";
8 8
9 final emptyList = new UnmodifiableListView([]); 9 final emptyList = new UnmodifiableListView([]);
10 final emptyMap = new _UnmodifiableMapView({}); 10 final emptyMap = new _UnmodifiableMapView({});
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 _unwrapAsyncNamed(namedArguments)); 462 _unwrapAsyncNamed(namedArguments));
463 }); 463 });
464 } 464 }
465 465
466 InstanceMirror findInContext(Symbol name, {ifAbsent: null}) { 466 InstanceMirror findInContext(Symbol name, {ifAbsent: null}) {
467 List<String> parts = _n(name).split(".").toList(growable: false); 467 List<String> parts = _n(name).split(".").toList(growable: false);
468 if (parts.length > 3) { 468 if (parts.length > 3) {
469 throw new ArgumentError("Invalid symbol: ${name}"); 469 throw new ArgumentError("Invalid symbol: ${name}");
470 } 470 }
471 List tuple = _computeFindInContext(_reflectee, parts); 471 List tuple = _computeFindInContext(_reflectee, parts);
472 if (tuple.length == 0) {
473 throw new UnsupportedError(
474 "ClosureMirror.findInContext not yet supported");
475 }
472 if (tuple[0]) { 476 if (tuple[0]) {
473 return reflect(tuple[1]); 477 return reflect(tuple[1]);
474 } 478 }
475 return ifAbsent == null ? null : ifAbsent(); 479 return ifAbsent == null ? null : ifAbsent();
476 } 480 }
477 481
478 String toString() => "ClosureMirror on '${Error.safeToString(_reflectee)}'"; 482 String toString() => "ClosureMirror on '${Error.safeToString(_reflectee)}'";
479 483
480 static _apply(arguments, argumentNames) 484 static _apply(arguments, argumentNames)
481 native 'ClosureMirror_apply'; 485 native 'ClosureMirror_apply';
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 if (typeMirror == null) { 1579 if (typeMirror == null) {
1576 typeMirror = makeLocalTypeMirror(key); 1580 typeMirror = makeLocalTypeMirror(key);
1577 _instanitationCache[key] = typeMirror; 1581 _instanitationCache[key] = typeMirror;
1578 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1582 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1579 _declarationCache[key] = typeMirror; 1583 _declarationCache[key] = typeMirror;
1580 } 1584 }
1581 } 1585 }
1582 return typeMirror; 1586 return typeMirror;
1583 } 1587 }
1584 } 1588 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698