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

Side by Side Diff: reflectable/lib/src/reflectable_implementation.dart

Issue 1182083002: Implement `.instanceMembers`. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Fix return type in test Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in 2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file. 3 // the LICENSE file.
4 4
5 /// Implementation of the reflectable interface using dart mirrors. 5 /// Implementation of the reflectable interface using dart mirrors.
6 library reflectable.src.reflectable_implementation; 6 library reflectable.src.reflectable_implementation;
7 7
8 import 'dart:mirrors' as dm; 8 import 'dart:mirrors' as dm;
9 import '../capability.dart'; 9 import '../capability.dart';
10 import '../reflectable.dart' as r; 10 import '../reflectable.dart' as r;
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 @override 486 @override
487 Map<String, r.DeclarationMirror> get declarations { 487 Map<String, r.DeclarationMirror> get declarations {
488 // TODO(sigurdm): Possibly cache this. 488 // TODO(sigurdm): Possibly cache this.
489 Map<String, r.DeclarationMirror> result = 489 Map<String, r.DeclarationMirror> result =
490 new Map<String, r.DeclarationMirror>(); 490 new Map<String, r.DeclarationMirror>();
491 _classMirror.declarations.forEach( 491 _classMirror.declarations.forEach(
492 (Symbol nameSymbol, dm.DeclarationMirror declarationMirror) { 492 (Symbol nameSymbol, dm.DeclarationMirror declarationMirror) {
493 String name = dm.MirrorSystem.getName(nameSymbol); 493 String name = dm.MirrorSystem.getName(nameSymbol);
494 if (declarationMirror is dm.MethodMirror) { 494 if (declarationMirror is dm.MethodMirror) {
495 if (declarationMirror.isAbstract) {
496 // Dart2js implementation of dart:mirrors does not include abstract
497 // members in declarations. We choose to go the same route.
498 return;
499 }
495 if ((declarationMirror.isStatic && 500 if ((declarationMirror.isStatic &&
496 reflectableSupportsStaticInvoke(_reflectable, name)) || 501 reflectableSupportsStaticInvoke(_reflectable, name)) ||
497 reflectableSupportsInstanceInvoke( 502 reflectableSupportsInstanceInvoke(
498 _reflectable, name, _classMirror)) { 503 _reflectable, name, _classMirror)) {
499 result[name] = wrapDeclarationMirror(declarationMirror, _reflectable); 504 result[name] = wrapDeclarationMirror(declarationMirror, _reflectable);
500 } 505 }
501 } else if (declarationMirror is dm.VariableMirror) { 506 } else if (declarationMirror is dm.VariableMirror) {
502 // For variableMirrors we test both for support of the name and the 507 // For variableMirrors we test both for support of the name and the
503 // derived setter name. 508 // derived setter name.
504 if ((declarationMirror.isStatic && 509 if ((declarationMirror.isStatic &&
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 991 }
987 992
988 @override 993 @override
989 int get hashCode => _sourceLocation.hashCode; 994 int get hashCode => _sourceLocation.hashCode;
990 995
991 @override 996 @override
992 String toString() { 997 String toString() {
993 return "_SourceLocationImpl('${_sourceLocation}')"; 998 return "_SourceLocationImpl('${_sourceLocation}')";
994 } 999 }
995 } 1000 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698