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

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

Issue 20465002: Implement ClassMirror.superclass with internal code for ordinary (but not function type) classes. R… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
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 // These values are allowed to be passed directly over the wire. 7 // These values are allowed to be passed directly over the wire.
8 bool _isSimpleValue(var value) { 8 bool _isSimpleValue(var value) {
9 return (value == null || value is num || value is String || value is bool); 9 return (value == null || value is num || value is String || value is bool);
10 } 10 }
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 SourceLocation get location { 444 SourceLocation get location {
445 throw new UnimplementedError( 445 throw new UnimplementedError(
446 'ClassMirror.location is not implemented'); 446 'ClassMirror.location is not implemented');
447 } 447 }
448 448
449 final bool isClass; 449 final bool isClass;
450 450
451 var _superclass; 451 var _superclass;
452 ClassMirror get superclass { 452 ClassMirror get superclass {
453 if (_superclass == null) {
454 Type supertype = _supertype(_reflectee);
siva 2013/07/25 21:54:12 var supertype?
455 if (supertype == null) {
456 // Object has no superclass.
457 return null;
458 }
459 _superclass = reflectClass(supertype);
460 }
453 if (_superclass is! Mirror) { 461 if (_superclass is! Mirror) {
454 _superclass = _superclass.resolve(mirrors); 462 _superclass = _superclass.resolve(mirrors);
455 } 463 }
456 return _superclass; 464 return _superclass;
457 } 465 }
458 466
459 var _superinterfaces; 467 var _superinterfaces;
460 List<ClassMirror> get superinterfaces { 468 List<ClassMirror> get superinterfaces {
461 if (_superinterfaces.length > 0 && 469 if (_superinterfaces.length > 0 &&
462 _superinterfaces[0] is! Mirror) { 470 _superinterfaces[0] is! Mirror) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // reflect() and then make them into a Dart list. 593 // reflect() and then make them into a Dart list.
586 return _metadata(_reflectee).map(reflect).toList(growable:false); 594 return _metadata(_reflectee).map(reflect).toList(growable:false);
587 } 595 }
588 596
589 static _name(reflectee) 597 static _name(reflectee)
590 native "ClassMirror_name"; 598 native "ClassMirror_name";
591 599
592 static _library(reflectee) 600 static _library(reflectee)
593 native "ClassMirror_library"; 601 native "ClassMirror_library";
594 602
603 static _supertype(reflectee)
604 native "ClassMirror_supertype";
605
595 _computeMembers(reflectee) 606 _computeMembers(reflectee)
596 native "ClassMirror_members"; 607 native "ClassMirror_members";
597 608
598 _invoke(reflectee, memberName, positionalArguments) 609 _invoke(reflectee, memberName, positionalArguments)
599 native 'ClassMirror_invoke'; 610 native 'ClassMirror_invoke';
600 611
601 _invokeGetter(reflectee, getterName) 612 _invokeGetter(reflectee, getterName)
602 native 'ClassMirror_invokeGetter'; 613 native 'ClassMirror_invokeGetter';
603 614
604 _invokeSetter(reflectee, setterName, value) 615 _invokeSetter(reflectee, setterName, value)
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1216 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1206 static ClassMirror reflectClass(Type key) { 1217 static ClassMirror reflectClass(Type key) {
1207 var classMirror = _classMirrorCache[key]; 1218 var classMirror = _classMirrorCache[key];
1208 if (classMirror == null) { 1219 if (classMirror == null) {
1209 classMirror = makeLocalClassMirror(key); 1220 classMirror = makeLocalClassMirror(key);
1210 _classMirrorCache[key] = classMirror; 1221 _classMirrorCache[key] = classMirror;
1211 } 1222 }
1212 return classMirror; 1223 return classMirror;
1213 } 1224 }
1214 } 1225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698