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 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 /// Opaque name used by mirrors, invocations and [Function.apply]. | 7 /// Opaque name used by mirrors, invocations and [Function.apply]. |
8 class Symbol { | 8 class Symbol { |
9 /** | 9 /** |
10 * Constructs a new Symbol. | 10 * Constructs a new Symbol. |
11 * | 11 * |
12 * An [ArgumentError] is thrown if [name] starts with an underscore, or if | 12 * The name must be a valid public Dart member name, |
13 * [name] is not a [String]. An [ArgumentError] is thrown if [name] is not | 13 * public constructor name, or library name, optionally qualified. |
14 * an empty string and is not a valid qualified identifier optionally | 14 * |
15 * followed by [:'=':]. | 15 * A qualified name is a valid name preceded by a public identifier name |
| 16 * and a '`.`', e.g., `foo.bar.baz=` is a qualified version of `baz=`. |
| 17 * That means that the content of the [name] String must be either |
| 18 * |
| 19 * * a valid public Dart identifier |
| 20 * (that is, an identifier not starting with "`_`"), |
| 21 * * such an identifier followed by "=" (a setter name), |
| 22 * * the name of a declarable operator |
| 23 * (one of "`+`", "`-`", "`*`", "`/`", "`%`", "`~/`", "`&`", "`|`", |
| 24 * "`^`", "`~`", "`<<`", "`>>`", "`<`", "`<=`", "`>`", "`>=`", "`==`", |
| 25 * "`[]`", "`[]=`", or "`unary-`"), |
| 26 * * any of the above preceeded by any number of qualifiers, |
| 27 * where a qualifier is a non-private identifier followed by '`.`', |
| 28 * * or the empty string (the default name of a library with not library |
| 29 * name declaration). |
16 * | 30 * |
17 * The following text is non-normative: | 31 * The following text is non-normative: |
18 * | 32 * |
19 * Creating non-const Symbol instances may result in larger output. If | 33 * Creating non-const Symbol instances may result in larger output. If |
20 * possible, use [MirrorsUsed] in "dart:mirrors" to specify which names might | 34 * possible, use [MirrorsUsed] in "dart:mirrors" to specify which names might |
21 * be passed to this constructor. | 35 * be passed to this constructor. |
22 */ | 36 */ |
23 const factory Symbol(String name) = internal.Symbol; | 37 const factory Symbol(String name) = internal.Symbol; |
24 } | 38 } |
OLD | NEW |