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

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

Issue 19512003: Implement VariableMirror creation with non-API code. To break circular initialization, have them fi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.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 // 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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 return owner is LibraryMirror; 1030 return owner is LibraryMirror;
1031 } 1031 }
1032 1032
1033 SourceLocation get location { 1033 SourceLocation get location {
1034 throw new UnimplementedError( 1034 throw new UnimplementedError(
1035 'VariableMirror.location is not implemented'); 1035 'VariableMirror.location is not implemented');
1036 } 1036 }
1037 1037
1038 var _type; 1038 var _type;
1039 TypeMirror get type { 1039 TypeMirror get type {
1040 if (_type == null) {
1041 _type = _VariableMirror_type(_reflectee);
1042 }
1040 if (_type is! Mirror) { 1043 if (_type is! Mirror) {
1041 _type = _type.resolve(mirrors); 1044 _type = _type.resolve(mirrors);
1042 } 1045 }
1043 return _type; 1046 return _type;
1044 } 1047 }
1045 1048
1046 final bool isStatic; 1049 final bool isStatic;
1047 final bool isFinal; 1050 final bool isFinal;
1048 1051
1049 String toString() => "VariableMirror on '${_n(simpleName)}'"; 1052 String toString() => "VariableMirror on '${_n(simpleName)}'";
1053
1054 static _VariableMirror_type(reflectee)
1055 native "VariableMirror_type";
1050 } 1056 }
1051 1057
1052 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl 1058 class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl
1053 implements ParameterMirror { 1059 implements ParameterMirror {
1054 _LocalParameterMirrorImpl(type, this.isOptional) 1060 _LocalParameterMirrorImpl(type, this.isOptional)
1055 : super(null, '<TODO:unnamed>', null, type, false, false) {} 1061 : super(null, '<TODO:unnamed>', null, type, false, false) {}
1056 1062
1057 final bool isOptional; 1063 final bool isOptional;
1058 1064
1059 String get defaultValue { 1065 String get defaultValue {
(...skipping 29 matching lines...) Expand all
1089 SourceLocation get location { 1095 SourceLocation get location {
1090 throw new UnimplementedError( 1096 throw new UnimplementedError(
1091 'TypeMirror.location is not implemented'); 1097 'TypeMirror.location is not implemented');
1092 } 1098 }
1093 1099
1094 Symbol get qualifiedName { 1100 Symbol get qualifiedName {
1095 return simpleName; 1101 return simpleName;
1096 } 1102 }
1097 1103
1098 String toString() => "TypeMirror on '${_n(simpleName)}'"; 1104 String toString() => "TypeMirror on '${_n(simpleName)}'";
1105
1106 // TODO(11955): Remove once dynamicType and voidType are canonical objects in
1107 // the object store.
1108 operator ==(other) {
1109 if (other is! _SpecialTypeMirrorImpl) {
1110 return false;
1111 }
1112 return this.simpleName == other.simpleName;
1113 }
ahe 2013/07/24 09:45:31 Always override hashCode when overriding operator=
1099 } 1114 }
1100 1115
1101 class _Mirrors { 1116 class _Mirrors {
1102 // Does a port refer to our local isolate? 1117 // Does a port refer to our local isolate?
1103 static bool isLocalPort(SendPort port) native 'Mirrors_isLocalPort'; 1118 static bool isLocalPort(SendPort port) native 'Mirrors_isLocalPort';
1104 1119
1105 static MirrorSystem _currentMirrorSystem = null; 1120 static MirrorSystem _currentMirrorSystem = null;
1106 1121
1107 // Creates a new local MirrorSystem. 1122 // Creates a new local MirrorSystem.
1108 static MirrorSystem makeLocalMirrorSystem() 1123 static MirrorSystem makeLocalMirrorSystem()
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror"); 1162 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1148 static ClassMirror reflectClass(Type key) { 1163 static ClassMirror reflectClass(Type key) {
1149 var classMirror = _classMirrorCache[key]; 1164 var classMirror = _classMirrorCache[key];
1150 if (classMirror == null) { 1165 if (classMirror == null) {
1151 classMirror = makeLocalClassMirror(key); 1166 classMirror = makeLocalClassMirror(key);
1152 _classMirrorCache[key] = classMirror; 1167 _classMirrorCache[key] = classMirror;
1153 } 1168 }
1154 return classMirror; 1169 return classMirror;
1155 } 1170 }
1156 } 1171 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698