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

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

Issue 71693003: Rename mixin typedef to mixin application alias in VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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') | runtime/vm/class_finalizer.h » ('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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 static _computeFindInContext(reflectee, name) 399 static _computeFindInContext(reflectee, name)
400 native 'ClosureMirror_find_in_context'; 400 native 'ClosureMirror_find_in_context';
401 } 401 }
402 402
403 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl 403 class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
404 implements ClassMirror { 404 implements ClassMirror {
405 _LocalClassMirrorImpl(reflectee, 405 _LocalClassMirrorImpl(reflectee,
406 reflectedType, 406 reflectedType,
407 String simpleName, 407 String simpleName,
408 this._isGeneric, 408 this._isGeneric,
409 this._isMixinTypedef, 409 this._isMixinAlias,
410 this._isGenericDeclaration) 410 this._isGenericDeclaration)
411 : this._simpleName = _s(simpleName), 411 : this._simpleName = _s(simpleName),
412 this._reflectedType = reflectedType, 412 this._reflectedType = reflectedType,
413 this._instantiator = reflectedType, 413 this._instantiator = reflectedType,
414 super(reflectee); 414 super(reflectee);
415 415
416 final Type _reflectedType; 416 final Type _reflectedType;
417 final bool _isGeneric; 417 final bool _isGeneric;
418 final bool _isMixinTypedef; 418 final bool _isMixinAlias;
419 final bool _isGenericDeclaration; 419 final bool _isGenericDeclaration;
420 Type _instantiator; 420 Type _instantiator;
421 421
422 bool get hasReflectedType => !_isGenericDeclaration; 422 bool get hasReflectedType => !_isGenericDeclaration;
423 Type get reflectedType { 423 Type get reflectedType {
424 if (!hasReflectedType) { 424 if (!hasReflectedType) {
425 throw new UnsupportedError( 425 throw new UnsupportedError(
426 "Declarations of generics have no reflected type"); 426 "Declarations of generics have no reflected type");
427 } 427 }
428 return _reflectedType; 428 return _reflectedType;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (supertype == null) { 470 if (supertype == null) {
471 // Object has no superclass. 471 // Object has no superclass.
472 return null; 472 return null;
473 } 473 }
474 _trueSuperclassField = reflectType(supertype); 474 _trueSuperclassField = reflectType(supertype);
475 _trueSuperclassField._instantiator = _instantiator; 475 _trueSuperclassField._instantiator = _instantiator;
476 } 476 }
477 return _trueSuperclassField; 477 return _trueSuperclassField;
478 } 478 }
479 ClassMirror get superclass { 479 ClassMirror get superclass {
480 return _isMixinTypedef ? _trueSuperclass._trueSuperclass : _trueSuperclass; 480 return _isMixinAlias ? _trueSuperclass._trueSuperclass : _trueSuperclass;
481 } 481 }
482 482
483 var _superinterfaces; 483 var _superinterfaces;
484 List<ClassMirror> get superinterfaces { 484 List<ClassMirror> get superinterfaces {
485 if (_superinterfaces == null) { 485 if (_superinterfaces == null) {
486 _superinterfaces = isOriginalDeclaration 486 _superinterfaces = isOriginalDeclaration
487 ? _nativeInterfaces(_reflectedType) 487 ? _nativeInterfaces(_reflectedType)
488 : _nativeInterfacesInstantiated(_reflectedType); 488 : _nativeInterfacesInstantiated(_reflectedType);
489 _superinterfaces = 489 _superinterfaces =
490 new UnmodifiableListView(_superinterfaces.map(reflectType)); 490 new UnmodifiableListView(_superinterfaces.map(reflectType));
(...skipping 10 matching lines...) Expand all
501 } 501 }
502 return _s( 502 return _s(
503 _n(klass.qualifiedName) 503 _n(klass.qualifiedName)
504 + ' with ' 504 + ' with '
505 + mixins.reversed.map((m)=>_n(m.qualifiedName)).join(', ')); 505 + mixins.reversed.map((m)=>_n(m.qualifiedName)).join(', '));
506 } 506 }
507 507
508 var _mixin; 508 var _mixin;
509 ClassMirror get mixin { 509 ClassMirror get mixin {
510 if (_mixin == null) { 510 if (_mixin == null) {
511 if (_isMixinTypedef) { 511 if (_isMixinAlias) {
512 Type mixinType = _nativeMixinInstantiated(_trueSuperclass._reflectedType , 512 Type mixinType = _nativeMixinInstantiated(_trueSuperclass._reflectedType ,
513 _instantiator); 513 _instantiator);
514 _mixin = reflectType(mixinType); 514 _mixin = reflectType(mixinType);
515 } else { 515 } else {
516 Type mixinType = _nativeMixinInstantiated(_reflectedType, _instantiator) ; 516 Type mixinType = _nativeMixinInstantiated(_reflectedType, _instantiator) ;
517 if (mixinType == null) { 517 if (mixinType == null) {
518 // The reflectee is not a mixin application. 518 // The reflectee is not a mixin application.
519 _mixin = this; 519 _mixin = this;
520 } else { 520 } else {
521 _mixin = reflectType(mixinType); 521 _mixin = reflectType(mixinType);
(...skipping 10 matching lines...) Expand all
532 decls.addAll(members); 532 decls.addAll(members);
533 decls.addAll(constructors); 533 decls.addAll(constructors);
534 typeVariables.forEach((tv) => decls[tv.simpleName] = tv); 534 typeVariables.forEach((tv) => decls[tv.simpleName] = tv);
535 return _declarations = 535 return _declarations =
536 new _UnmodifiableMapView<Symbol, DeclarationMirror>(decls); 536 new _UnmodifiableMapView<Symbol, DeclarationMirror>(decls);
537 } 537 }
538 538
539 Map<Symbol, Mirror> _members; 539 Map<Symbol, Mirror> _members;
540 Map<Symbol, Mirror> get members { 540 Map<Symbol, Mirror> get members {
541 if (_members == null) { 541 if (_members == null) {
542 var whoseMembers = _isMixinTypedef ? _trueSuperclass : this; 542 var whoseMembers = _isMixinAlias ? _trueSuperclass : this;
543 _members = _makeMemberMap(mixin._computeMembers(whoseMembers._reflectee)); 543 _members = _makeMemberMap(mixin._computeMembers(whoseMembers._reflectee));
544 } 544 }
545 return _members; 545 return _members;
546 } 546 }
547 547
548 Map<Symbol, MethodMirror> _methods; 548 Map<Symbol, MethodMirror> _methods;
549 Map<Symbol, MethodMirror> get methods { 549 Map<Symbol, MethodMirror> get methods {
550 if (_methods == null) { 550 if (_methods == null) {
551 _methods = _filterMap( 551 _methods = _filterMap(
552 members, 552 members,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (_constructors == null) { 590 if (_constructors == null) {
591 var constructorsList = _computeConstructors(_reflectee); 591 var constructorsList = _computeConstructors(_reflectee);
592 var stringName = _n(simpleName); 592 var stringName = _n(simpleName);
593 constructorsList.forEach((c) => c._patchConstructorName(stringName)); 593 constructorsList.forEach((c) => c._patchConstructorName(stringName));
594 _constructors = _makeMemberMap(constructorsList); 594 _constructors = _makeMemberMap(constructorsList);
595 } 595 }
596 return _constructors; 596 return _constructors;
597 } 597 }
598 598
599 bool get _isAnonymousMixinApplication { 599 bool get _isAnonymousMixinApplication {
600 if (_isMixinTypedef) return false; // Named mixin application. 600 if (_isMixinAlias) return false; // Named mixin application.
601 if (mixin == this) return false; // Not a mixin application. 601 if (mixin == this) return false; // Not a mixin application.
602 return true; 602 return true;
603 } 603 }
604 604
605 List<TypeVariableMirror> _typeVariables = null; 605 List<TypeVariableMirror> _typeVariables = null;
606 List<TypeVariableMirror> get typeVariables { 606 List<TypeVariableMirror> get typeVariables {
607 if (_typeVariables == null) { 607 if (_typeVariables == null) {
608 if (_isAnonymousMixinApplication) return _typeVariables = emptyList; 608 if (_isAnonymousMixinApplication) return _typeVariables = emptyList;
609 _typeVariables = new List<TypeVariableMirror>(); 609 _typeVariables = new List<TypeVariableMirror>();
610 610
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 if (typeMirror == null) { 1453 if (typeMirror == null) {
1454 typeMirror = makeLocalTypeMirror(key); 1454 typeMirror = makeLocalTypeMirror(key);
1455 _instanitationCache[key] = typeMirror; 1455 _instanitationCache[key] = typeMirror;
1456 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { 1456 if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
1457 _declarationCache[key] = typeMirror; 1457 _declarationCache[key] = typeMirror;
1458 } 1458 }
1459 } 1459 }
1460 return typeMirror; 1460 return typeMirror;
1461 } 1461 }
1462 } 1462 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/class_finalizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698