OLD | NEW |
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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 Function operator [](Symbol selector) { | 1143 Function operator [](Symbol selector) { |
1144 var target = _functions[selector]; | 1144 var target = _functions[selector]; |
1145 if (target == null || !target.isRegularMethod) { | 1145 if (target == null || !target.isRegularMethod) { |
1146 throw new ArgumentError( | 1146 throw new ArgumentError( |
1147 "${MirrorSystem.getName(simpleName)} has no top-level method " | 1147 "${MirrorSystem.getName(simpleName)} has no top-level method " |
1148 "${MirrorSystem.getName(selector)}"); | 1148 "${MirrorSystem.getName(selector)}"); |
1149 } | 1149 } |
1150 return new _InvocationTrampoline(this, selector); | 1150 return new _InvocationTrampoline(this, selector); |
1151 } | 1151 } |
1152 | 1152 |
| 1153 var _cachedLibraryDependencies; |
| 1154 get libraryDependencies { |
| 1155 if (_cachedLibraryDependencies == null) { |
| 1156 _cachedLibraryDependencies = _libraryDependencies(_reflectee); |
| 1157 } |
| 1158 return _cachedLibraryDependencies; |
| 1159 } |
| 1160 |
| 1161 _libraryDependencies(reflectee) |
| 1162 native 'LibraryMirror_libraryDependencies'; |
| 1163 |
1153 _invoke(reflectee, memberName, arguments, argumentNames) | 1164 _invoke(reflectee, memberName, arguments, argumentNames) |
1154 native 'LibraryMirror_invoke'; | 1165 native 'LibraryMirror_invoke'; |
1155 | 1166 |
1156 _invokeGetter(reflectee, getterName) | 1167 _invokeGetter(reflectee, getterName) |
1157 native 'LibraryMirror_invokeGetter'; | 1168 native 'LibraryMirror_invokeGetter'; |
1158 | 1169 |
1159 _invokeSetter(reflectee, setterName, value) | 1170 _invokeSetter(reflectee, setterName, value) |
1160 native 'LibraryMirror_invokeSetter'; | 1171 native 'LibraryMirror_invokeSetter'; |
1161 | 1172 |
1162 _computeMembers(reflectee) | 1173 _computeMembers(reflectee) |
1163 native "LibraryMirror_members"; | 1174 native "LibraryMirror_members"; |
1164 } | 1175 } |
1165 | 1176 |
| 1177 class _LocalLibraryDependencyMirror |
| 1178 extends _LocalMirror implements LibraryDependencyMirror { |
| 1179 final LibraryMirror sourceLibrary; |
| 1180 final LibraryMirror targetLibrary; |
| 1181 final List<CombinatorMirror> combinators; |
| 1182 final Symbol prefix; |
| 1183 final bool isImport; |
| 1184 final List<InstanceMirror> metadata; |
| 1185 |
| 1186 _LocalLibraryDependencyMirror(this.sourceLibrary, |
| 1187 this.targetLibrary, |
| 1188 this.combinators, |
| 1189 prefixString, |
| 1190 this.isImport, |
| 1191 unwrappedMetadata) |
| 1192 : prefix = _s(prefixString), |
| 1193 metadata = new UnmodifiableListView(unwrappedMetadata.map(reflect)); |
| 1194 |
| 1195 bool get isExport => !isImport; |
| 1196 } |
| 1197 |
| 1198 class _LocalCombinatorMirror extends _LocalMirror implements CombinatorMirror { |
| 1199 final List<Symbol> identifiers; |
| 1200 final bool isShow; |
| 1201 |
| 1202 _LocalCombinatorMirror(identifierString, this.isShow) |
| 1203 : this.identifiers = [_s(identifierString)]; |
| 1204 |
| 1205 bool get isHide => !isShow; |
| 1206 } |
| 1207 |
1166 class _LocalMethodMirror extends _LocalDeclarationMirror | 1208 class _LocalMethodMirror extends _LocalDeclarationMirror |
1167 implements MethodMirror { | 1209 implements MethodMirror { |
1168 final bool isStatic; | 1210 final bool isStatic; |
1169 final bool isAbstract; | 1211 final bool isAbstract; |
1170 final bool isGetter; | 1212 final bool isGetter; |
1171 final bool isSetter; | 1213 final bool isSetter; |
1172 final bool isConstructor; | 1214 final bool isConstructor; |
1173 final bool isConstConstructor; | 1215 final bool isConstConstructor; |
1174 final bool isGenerativeConstructor; | 1216 final bool isGenerativeConstructor; |
1175 final bool isRedirectingConstructor; | 1217 final bool isRedirectingConstructor; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 if (typeMirror == null) { | 1534 if (typeMirror == null) { |
1493 typeMirror = makeLocalTypeMirror(key); | 1535 typeMirror = makeLocalTypeMirror(key); |
1494 _instanitationCache[key] = typeMirror; | 1536 _instanitationCache[key] = typeMirror; |
1495 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1537 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1496 _declarationCache[key] = typeMirror; | 1538 _declarationCache[key] = typeMirror; |
1497 } | 1539 } |
1498 } | 1540 } |
1499 return typeMirror; | 1541 return typeMirror; |
1500 } | 1542 } |
1501 } | 1543 } |
OLD | NEW |