| 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 // For the purposes of the mirrors library, we adopt a naming | 5 // For the purposes of the mirrors library, we adopt a naming |
| 6 // convention with respect to getters and setters. Specifically, for | 6 // convention with respect to getters and setters. Specifically, for |
| 7 // some variable or field... | 7 // some variable or field... |
| 8 // | 8 // |
| 9 // var myField; | 9 // var myField; |
| 10 // | 10 // |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 * | 1104 * |
| 1105 * The following text is non-normative: | 1105 * The following text is non-normative: |
| 1106 * | 1106 * |
| 1107 * In some scenarios, for example, when minifying Dart code, or when generating | 1107 * In some scenarios, for example, when minifying Dart code, or when generating |
| 1108 * JavaScript code from a Dart program, the size and performance of the output | 1108 * JavaScript code from a Dart program, the size and performance of the output |
| 1109 * can suffer from use of reflection. In those cases, telling the compiler | 1109 * can suffer from use of reflection. In those cases, telling the compiler |
| 1110 * what is used, can have a significant impact. | 1110 * what is used, can have a significant impact. |
| 1111 * | 1111 * |
| 1112 * Example usage: | 1112 * Example usage: |
| 1113 * | 1113 * |
| 1114 * [: | 1114 * @MirrorsUsed(symbols: 'foo', override: '*') |
| 1115 * @MirrorsUsed(symbols: 'foo', override: '*') | 1115 * import 'dart:mirrors'; |
| 1116 * import 'dart:mirrors'; | |
| 1117 * | 1116 * |
| 1118 * class Foo { | 1117 * class Foo { |
| 1119 * noSuchMethod(Invocation invocation) { | 1118 * noSuchMethod(Invocation invocation) { |
| 1120 * print(Mirrors.getName(invocation.memberName)); | 1119 * print(Mirrors.getName(invocation.memberName)); |
| 1121 * } | 1120 * } |
| 1122 * } | 1121 * } |
| 1123 * | 1122 * |
| 1124 * main() { | 1123 * main() { |
| 1125 * new Foo().foo(); // Prints "foo". | 1124 * new Foo().foo(); // Prints "foo". |
| 1126 * new Foo().bar(); // Might print an arbitrary (mangled) name, "bar". | 1125 * new Foo().bar(); // Might print an arbitrary (mangled) name, "bar". |
| 1127 * } | 1126 * } |
| 1128 * :] | |
| 1129 */ | 1127 */ |
| 1130 // TODO(ahe): Remove ", override: '*'" when it isn't necessary anymore. | 1128 // TODO(ahe): Remove ", override: '*'" when it isn't necessary anymore. |
| 1131 class MirrorsUsed { | 1129 class MirrorsUsed { |
| 1132 // Note: the fields of this class are untyped. This is because the most | 1130 // Note: the fields of this class are untyped. This is because the most |
| 1133 // convenient way to specify to specify symbols today is using a single | 1131 // convenient way to specify to specify symbols today is using a single |
| 1134 // string. In some cases, a const list of classes might be convenient. Some | 1132 // string. In some cases, a const list of classes might be convenient. Some |
| 1135 // might prefer to use a const list of symbols. | 1133 // might prefer to use a const list of symbols. |
| 1136 | 1134 |
| 1137 /** | 1135 /** |
| 1138 * The list of strings passed to new [Symbol], and symbols that might be | 1136 * The list of strings passed to new [Symbol], and symbols that might be |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 * | 1186 * |
| 1189 * When used as metadata on an import of "dart:mirrors", this metadata does | 1187 * When used as metadata on an import of "dart:mirrors", this metadata does |
| 1190 * not apply to the library in which the annotation is used, but instead | 1188 * not apply to the library in which the annotation is used, but instead |
| 1191 * applies to the other libraries (all libraries if "*" is used). | 1189 * applies to the other libraries (all libraries if "*" is used). |
| 1192 */ | 1190 */ |
| 1193 final override; | 1191 final override; |
| 1194 | 1192 |
| 1195 const MirrorsUsed( | 1193 const MirrorsUsed( |
| 1196 {this.symbols, this.targets, this.metaTargets, this.override}); | 1194 {this.symbols, this.targets, this.metaTargets, this.override}); |
| 1197 } | 1195 } |
| OLD | NEW |