| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Prints all information about all mirrors. This tests that it is possible to | 5 /// Prints all information about all mirrors. This tests that it is possible to |
| 6 /// enumerate all reflective information without crashing. | 6 /// enumerate all reflective information without crashing. |
| 7 | 7 |
| 8 // Note: Adding imports below is fine for regression tests. For example, | 8 // Note: Adding imports below is fine for regression tests. For example, |
| 9 // 'crash_library_metadata.dart' is imported to ensure the compiler doesn't | 9 // 'crash_library_metadata.dart' is imported to ensure the compiler doesn't |
| 10 // crash. | 10 // crash. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (first) { | 67 if (first) { |
| 68 first = false; | 68 first = false; |
| 69 } else { | 69 } else { |
| 70 buffer.write(', '); | 70 buffer.write(', '); |
| 71 } | 71 } |
| 72 buffer | 72 buffer |
| 73 ..write(n(name)) | 73 ..write(n(name)) |
| 74 ..write(': ') | 74 ..write(': ') |
| 75 ..write(stringifyInstance(mirror.getField(name))); | 75 ..write(stringifyInstance(mirror.getField(name))); |
| 76 }); | 76 }); |
| 77 return buffer | 77 buffer.write(')'); |
| 78 ..write(')') | 78 return buffer.toString(); |
| 79 ..toString(); | |
| 80 } | 79 } |
| 81 | 80 |
| 82 String stringifyMetadata(InstanceMirror mirror) { | 81 String stringifyMetadata(InstanceMirror mirror) { |
| 83 return '@${stringifyInstance(mirror)}'; | 82 return '@${stringifyInstance(mirror)}'; |
| 84 } | 83 } |
| 85 | 84 |
| 86 bool writeType(TypeMirror mirror) { | 85 bool writeType(TypeMirror mirror) { |
| 87 if (mirror == null || mirror == dynamicType) return false; | 86 if (mirror == null || mirror == dynamicType) return false; |
| 88 w('${n(mirror.simpleName)} '); | 87 w('${n(mirror.simpleName)} '); |
| 89 return true; | 88 return true; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return buffer; | 175 return buffer; |
| 177 } | 176 } |
| 178 } | 177 } |
| 179 | 178 |
| 180 main() { | 179 main() { |
| 181 print(MirrorPrinter.stringify(currentMirrorSystem().libraries)); | 180 print(MirrorPrinter.stringify(currentMirrorSystem().libraries)); |
| 182 // Clear the nodes to avoid confusing the fine test framework (by "fine" I | 181 // Clear the nodes to avoid confusing the fine test framework (by "fine" I |
| 183 // mean something else) -- ahe. | 182 // mean something else) -- ahe. |
| 184 document.body.nodes.clear(); | 183 document.body.nodes.clear(); |
| 185 } | 184 } |
| OLD | NEW |