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

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

Issue 22292002: Reflection on generics. (Closed) Base URL: https://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 import "dart:collection"; 7 import "dart:collection";
8 8
9 // These values are allowed to be passed directly over the wire. 9 // These values are allowed to be passed directly over the wire.
10 bool _isSimpleValue(var value) { 10 bool _isSimpleValue(var value) {
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 var mirror; 494 var mirror;
495 for (var i = 0; i < params.length; i += 2) { 495 for (var i = 0; i < params.length; i += 2) {
496 mirror = new _LocalTypeVariableMirrorImpl( 496 mirror = new _LocalTypeVariableMirrorImpl(
497 params[i + 1], params[i], this); 497 params[i + 1], params[i], this);
498 _typeVariables[mirror.simpleName] = mirror; 498 _typeVariables[mirror.simpleName] = mirror;
499 } 499 }
500 } 500 }
501 return _typeVariables; 501 return _typeVariables;
502 } 502 }
503 503
504 Map<Symbol, TypeMirror> _typeArguments = null;
504 Map<Symbol, TypeMirror> get typeArguments { 505 Map<Symbol, TypeMirror> get typeArguments {
505 throw new UnimplementedError( 506 if(_typeArguments == null) {
506 'ClassMirror.typeArguments is not implemented'); 507 _typeArguments = _computeTypeArguments(_reflectee);
508 }
509 return _typeArguments;
507 } 510 }
508 511
509 bool get isOriginalDeclaration { 512 bool get isOriginalDeclaration {
510 throw new UnimplementedError( 513 throw new UnimplementedError(
511 'ClassMirror.isOriginalDeclaration is not implemented'); 514 'ClassMirror.isOriginalDeclaration is not implemented');
512 } 515 }
513 516
514 ClassMirror get genericDeclaration { 517 ClassMirror get genericDeclaration {
515 throw new UnimplementedError( 518 throw new UnimplementedError(
516 'ClassMirror.originalDeclaration is not implemented'); 519 'ClassMirror.originalDeclaration is not implemented');
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 native 'ClassMirror_invokeGetter'; 591 native 'ClassMirror_invokeGetter';
589 592
590 _invokeSetter(reflectee, setterName, value) 593 _invokeSetter(reflectee, setterName, value)
591 native 'ClassMirror_invokeSetter'; 594 native 'ClassMirror_invokeSetter';
592 595
593 static _invokeConstructor(reflectee, constructorName, positionalArguments) 596 static _invokeConstructor(reflectee, constructorName, positionalArguments)
594 native 'ClassMirror_invokeConstructor'; 597 native 'ClassMirror_invokeConstructor';
595 598
596 static _ClassMirror_type_variables(reflectee) 599 static _ClassMirror_type_variables(reflectee)
597 native "ClassMirror_type_variables"; 600 native "ClassMirror_type_variables";
601
602 static _computeTypeArguments(reflectee)
603 native "ClassMirror_type_arguments";
598 } 604 }
599 605
600 class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl 606 class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
601 implements FunctionTypeMirror { 607 implements FunctionTypeMirror {
602 _LocalFunctionTypeMirrorImpl(reflectee) : super(reflectee, null); 608 _LocalFunctionTypeMirrorImpl(reflectee) : super(reflectee, null);
603 609
604 // FunctionTypeMirrors have a simpleName generated from their signature. 610 // FunctionTypeMirrors have a simpleName generated from their signature.
605 Symbol _simpleName = null; 611 Symbol _simpleName = null;
606 Symbol get simpleName { 612 Symbol get simpleName {
607 if (_simpleName == null) { 613 if (_simpleName == null) {
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1148 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1143 static ClassMirror reflectClass(Type key) { 1149 static ClassMirror reflectClass(Type key) {
1144 var classMirror = _classMirrorCache[key]; 1150 var classMirror = _classMirrorCache[key];
1145 if (classMirror == null) { 1151 if (classMirror == null) {
1146 classMirror = makeLocalClassMirror(key); 1152 classMirror = makeLocalClassMirror(key);
1147 _classMirrorCache[key] = classMirror; 1153 _classMirrorCache[key] = classMirror;
1148 } 1154 }
1149 return classMirror; 1155 return classMirror;
1150 } 1156 }
1151 } 1157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698