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