OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Test that everything reachable from a [MirrorSystem] can be accessed. | 5 // Test that everything reachable from a [MirrorSystem] can be accessed. |
6 | 6 |
7 library test.mirrors.reader; | 7 library test.mirrors.reader; |
8 | 8 |
9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
10 import 'mirrors_reader.dart'; | 10 import 'mirrors_reader.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 if (tag.endsWith('.metadata')) { | 25 if (tag.endsWith('.metadata')) { |
26 return true;// Issue 10905. | 26 return true;// Issue 10905. |
27 } | 27 } |
28 } | 28 } |
29 return false; | 29 return false; |
30 } | 30 } |
31 | 31 |
32 bool expectUnsupported(var receiver, String tag, UnsupportedError exception) { | 32 bool expectUnsupported(var receiver, String tag, UnsupportedError exception) { |
33 // [DeclarationMirror.location] is intentionally not supported in runtime | 33 // [DeclarationMirror.location] is intentionally not supported in runtime |
34 // mirrors. | 34 // mirrors. |
35 if (receiver is DeclarationMirror && tag == 'location') { | 35 |
36 return true; | |
37 } | |
38 if (mirrorSystemType == '_LocalMirrorSystem') { | 36 if (mirrorSystemType == '_LocalMirrorSystem') { |
39 // VM mirror system. | 37 // VM mirror system. |
| 38 if (receiver is DeclarationMirror && tag == 'location') { |
| 39 return receiver is! MethodMirror; |
| 40 } |
40 } else if (mirrorSystemType == 'JsMirrorSystem') { | 41 } else if (mirrorSystemType == 'JsMirrorSystem') { |
41 // Dart2js runtime mirror system. | 42 // Dart2js runtime mirror system. |
| 43 if (receiver is DeclarationMirror && tag == 'location') { |
| 44 return true; |
| 45 } |
42 } | 46 } |
43 return false; | 47 return false; |
44 } | 48 } |
45 } | 49 } |
46 | 50 |
47 void main([List<String> arguments = const <String>[]]) { | 51 void main([List<String> arguments = const <String>[]]) { |
48 MirrorSystem mirrors = currentMirrorSystem(); | 52 MirrorSystem mirrors = currentMirrorSystem(); |
49 MirrorsReader reader = new RuntimeMirrorsReader(mirrors, | 53 MirrorsReader reader = new RuntimeMirrorsReader(mirrors, |
50 verbose: arguments.contains('-v'), | 54 verbose: arguments.contains('-v'), |
51 includeStackTrace: arguments.contains('-s')); | 55 includeStackTrace: arguments.contains('-s')); |
52 reader.checkMirrorSystem(mirrors); | 56 reader.checkMirrorSystem(mirrors); |
53 } | 57 } |
OLD | NEW |