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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 Function operator [](Symbol selector) { | 1283 Function operator [](Symbol selector) { |
1284 var target = _functions[selector]; | 1284 var target = _functions[selector]; |
1285 if (target == null || !target.isRegularMethod) { | 1285 if (target == null || !target.isRegularMethod) { |
1286 throw new ArgumentError( | 1286 throw new ArgumentError( |
1287 "${MirrorSystem.getName(simpleName)} has no top-level method " | 1287 "${MirrorSystem.getName(simpleName)} has no top-level method " |
1288 "${MirrorSystem.getName(selector)}"); | 1288 "${MirrorSystem.getName(selector)}"); |
1289 } | 1289 } |
1290 return new _InvocationTrampoline(this, selector); | 1290 return new _InvocationTrampoline(this, selector); |
1291 } | 1291 } |
1292 | 1292 |
1293 var _cachedLibraryDependencies; | |
1294 get libraryDependencies { | |
1295 if (_cachedLibraryDependencies == null) { | |
1296 _cachedLibraryDependencies = _libraryDependencies(_reflectee); | |
1297 } | |
1298 return _cachedLibraryDependencies; | |
1299 } | |
1300 | |
1301 _libraryDependencies(reflectee) | |
1302 native 'LibraryMirror_libraryDependencies'; | |
1303 | |
1304 _invoke(reflectee, memberName, arguments, argumentNames) | 1293 _invoke(reflectee, memberName, arguments, argumentNames) |
1305 native 'LibraryMirror_invoke'; | 1294 native 'LibraryMirror_invoke'; |
1306 | 1295 |
1307 _invokeGetter(reflectee, getterName) | 1296 _invokeGetter(reflectee, getterName) |
1308 native 'LibraryMirror_invokeGetter'; | 1297 native 'LibraryMirror_invokeGetter'; |
1309 | 1298 |
1310 _invokeSetter(reflectee, setterName, value) | 1299 _invokeSetter(reflectee, setterName, value) |
1311 native 'LibraryMirror_invokeSetter'; | 1300 native 'LibraryMirror_invokeSetter'; |
1312 | 1301 |
1313 _computeMembers(reflectee) | 1302 _computeMembers(reflectee) |
1314 native "LibraryMirror_members"; | 1303 native "LibraryMirror_members"; |
1315 } | 1304 } |
1316 | 1305 |
1317 class _LocalLibraryDependencyMirror | |
1318 extends _LocalMirror implements LibraryDependencyMirror { | |
1319 final LibraryMirror sourceLibrary; | |
1320 final LibraryMirror targetLibrary; | |
1321 final List<CombinatorMirror> combinators; | |
1322 final Symbol prefix; | |
1323 final bool isImport; | |
1324 final List<InstanceMirror> metadata; | |
1325 | |
1326 _LocalLibraryDependencyMirror(this.sourceLibrary, | |
1327 this.targetLibrary, | |
1328 this.combinators, | |
1329 prefixString, | |
1330 this.isImport, | |
1331 unwrappedMetadata) | |
1332 : prefix = _s(prefixString), | |
1333 metadata = new UnmodifiableListView(unwrappedMetadata.map(reflect)); | |
1334 | |
1335 bool get isExport => !isImport; | |
1336 } | |
1337 | |
1338 class _LocalCombinatorMirror extends _LocalMirror implements CombinatorMirror { | |
1339 final List<Symbol> identifiers; | |
1340 final bool isShow; | |
1341 | |
1342 _LocalCombinatorMirror(identifierString, this.isShow) | |
1343 : this.identifiers = [_s(identifierString)]; | |
1344 | |
1345 bool get isHide => !isShow; | |
1346 } | |
1347 | |
1348 class _LocalMethodMirror extends _LocalDeclarationMirror | 1306 class _LocalMethodMirror extends _LocalDeclarationMirror |
1349 implements MethodMirror { | 1307 implements MethodMirror { |
1350 final bool isStatic; | 1308 final bool isStatic; |
1351 final bool isAbstract; | 1309 final bool isAbstract; |
1352 final bool isGetter; | 1310 final bool isGetter; |
1353 final bool isSetter; | 1311 final bool isSetter; |
1354 final bool isConstructor; | 1312 final bool isConstructor; |
1355 final bool isConstConstructor; | 1313 final bool isConstConstructor; |
1356 final bool isGenerativeConstructor; | 1314 final bool isGenerativeConstructor; |
1357 final bool isRedirectingConstructor; | 1315 final bool isRedirectingConstructor; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 if (typeMirror == null) { | 1645 if (typeMirror == null) { |
1688 typeMirror = makeLocalTypeMirror(key); | 1646 typeMirror = makeLocalTypeMirror(key); |
1689 _instanitationCache[key] = typeMirror; | 1647 _instanitationCache[key] = typeMirror; |
1690 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1648 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1691 _declarationCache[key] = typeMirror; | 1649 _declarationCache[key] = typeMirror; |
1692 } | 1650 } |
1693 } | 1651 } |
1694 return typeMirror; | 1652 return typeMirror; |
1695 } | 1653 } |
1696 } | 1654 } |
OLD | NEW |