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 LICESNE file. | 3 // BSD-style license that can be found in the LICESNE file. |
4 | 4 |
5 library mirrors.reader; | 5 library mirrors.reader; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'mirrors_visitor.dart'; | 8 import 'mirrors_visitor.dart'; |
9 | 9 |
10 class ReadError { | 10 class ReadError { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 throw 'Unexpected errors occurred reading mirrors.'; | 47 throw 'Unexpected errors occurred reading mirrors.'; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 // Skip mirrors so that each mirror is only visited once. | 51 // Skip mirrors so that each mirror is only visited once. |
52 bool skipMirror(Mirror mirror) { | 52 bool skipMirror(Mirror mirror) { |
53 if (fatalError) return true; | 53 if (fatalError) return true; |
54 if (mirror is TypeMirror) { | 54 if (mirror is TypeMirror) { |
55 if (mirror.isOriginalDeclaration) { | 55 if (mirror.isOriginalDeclaration) { |
56 // Visit the declation once. | 56 // Visit the declaration once. |
57 return !declarations.add(mirror); | 57 return !declarations.add(mirror); |
58 } else { | 58 } else { |
59 // Visit only one instantiation. | 59 // Visit only one instantiation. |
60 return !instantiations.add(mirror.originalDeclaration); | 60 return !instantiations.add(mirror.originalDeclaration); |
61 } | 61 } |
62 } | 62 } |
63 return !visited.add(mirror); | 63 return !visited.add(mirror); |
64 } | 64 } |
65 | 65 |
66 reportError(var receiver, String tag, var exception, StackTrace stackTrace) { | 66 reportError(var receiver, String tag, var exception, StackTrace stackTrace) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 | 252 |
253 visitVariableMirror(VariableMirror mirror) { | 253 visitVariableMirror(VariableMirror mirror) { |
254 super.visitVariableMirror(mirror); | 254 super.visitVariableMirror(mirror); |
255 visit(mirror, 'isConst', () => mirror.isConst); | 255 visit(mirror, 'isConst', () => mirror.isConst); |
256 visit(mirror, 'isFinal', () => mirror.isFinal); | 256 visit(mirror, 'isFinal', () => mirror.isFinal); |
257 visit(mirror, 'isStatic', () => mirror.isStatic); | 257 visit(mirror, 'isStatic', () => mirror.isStatic); |
258 visit(mirror, 'type', () => mirror.type); | 258 visit(mirror, 'type', () => mirror.type); |
259 } | 259 } |
260 } | 260 } |
OLD | NEW |