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

Side by Side Diff: tests/lib/mirrors/mirrors_reader_test.dart

Issue 922023002: Implement DeclarationMirror.location for all but ParameterMirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
OLDNEW
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 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 visitClassMirror(ClassMirror mirror) { 28 visitClassMirror(ClassMirror mirror) {
29 super.visitClassMirror(mirror); 29 super.visitClassMirror(mirror);
30 Expect.isNotNull(mirror.owner); 30 Expect.isNotNull(mirror.owner);
31 } 31 }
32 32
33 bool allowUnsupported(var receiver, String tag, UnsupportedError exception) { 33 bool allowUnsupported(var receiver, String tag, UnsupportedError exception) {
34 if (mirrorSystemType == '_LocalMirrorSystem') { 34 if (mirrorSystemType == '_LocalMirrorSystem') {
35 // VM mirror system. 35 // VM mirror system.
36 if (tag.endsWith('location')) {
37 return receiver is ParameterMirror;
38 }
36 } else if (mirrorSystemType == 'JsMirrorSystem') { 39 } else if (mirrorSystemType == 'JsMirrorSystem') {
37 // Dart2js runtime mirror system. 40 // Dart2js runtime mirror system.
38 if (tag.endsWith('.metadata')) { 41 if (tag.endsWith('.metadata')) {
39 return true;// Issue 10905. 42 return true;// Issue 10905.
40 } 43 }
41 } 44 }
42 return false; 45 return false;
43 } 46 }
44 47
45 bool expectUnsupported(var receiver, String tag, UnsupportedError exception) { 48 bool expectUnsupported(var receiver, String tag, UnsupportedError exception) {
46 // [DeclarationMirror.location] is intentionally not supported in runtime 49 // [DeclarationMirror.location] is intentionally not supported in runtime
47 // mirrors. 50 // mirrors.
48 51
49 if (mirrorSystemType == '_LocalMirrorSystem') { 52 if (mirrorSystemType == '_LocalMirrorSystem') {
50 // VM mirror system. 53 // VM mirror system.
51 if (receiver is DeclarationMirror && tag == 'location') {
52 return receiver is! MethodMirror;
53 }
54 } else if (mirrorSystemType == 'JsMirrorSystem') { 54 } else if (mirrorSystemType == 'JsMirrorSystem') {
55 // Dart2js runtime mirror system. 55 // Dart2js runtime mirror system.
56 if (receiver is DeclarationMirror && tag == 'location') { 56 if (receiver is DeclarationMirror && tag == 'location') {
57 return true; 57 return true;
58 } 58 }
59 } 59 }
60 return false; 60 return false;
61 } 61 }
62 } 62 }
63 63
64 void main([List<String> arguments = const <String>[]]) { 64 void main([List<String> arguments = const <String>[]]) {
65 MirrorSystem mirrors = currentMirrorSystem(); 65 MirrorSystem mirrors = currentMirrorSystem();
66 MirrorsReader reader = new RuntimeMirrorsReader(mirrors, 66 MirrorsReader reader = new RuntimeMirrorsReader(mirrors,
67 verbose: arguments.contains('-v'), 67 verbose: arguments.contains('-v'),
68 includeStackTrace: arguments.contains('-s')); 68 includeStackTrace: arguments.contains('-s'));
69 reader.checkMirrorSystem(mirrors); 69 reader.checkMirrorSystem(mirrors);
70 } 70 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/method_mirror_location_test.dart ('k') | tests/lib/mirrors/other_declarations_location_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698