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 abstract class Symbol { | 8 abstract class Symbol { |
9 /** | 9 /** |
10 * Constructs a new Symbol. | 10 * Constructs a new Symbol. |
11 * | 11 * |
12 * The name must be a valid public Dart member name, | 12 * The name must be a valid public Dart member name, |
13 * public constructor name, or library name, optionally qualified. | 13 * public constructor name, or library name, optionally qualified. |
14 * | 14 * |
15 * A qualified name is a valid name preceded by a public identifier name | 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=`. | 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 | 17 * That means that the content of the [name] String must be either |
18 * | 18 * |
19 * * a valid public Dart identifier | 19 * * a valid public Dart identifier |
20 * (that is, an identifier not starting with "`_`"), | 20 * (that is, an identifier not starting with "`_`"), |
21 * * such an identifier followed by "=" (a setter name), | 21 * * such an identifier followed by "=" (a setter name), |
22 * * the name of a declarable operator | 22 * * the name of a declarable operator |
23 * (one of "`+`", "`-`", "`*`", "`/`", "`%`", "`~/`", "`&`", "`|`", | 23 * (one of "`+`", "`-`", "`*`", "`/`", "`%`", "`~/`", "`&`", "`|`", |
24 * "`^`", "`~`", "`<<`", "`>>`", "`<`", "`<=`", "`>`", "`>=`", "`==`", | 24 * "`^`", "`~`", "`<<`", "`>>`", "`<`", "`<=`", "`>`", "`>=`", "`==`", |
25 * "`[]`", "`[]=`", or "`unary-`"), | 25 * "`[]`", "`[]=`", or "`unary-`"), |
26 * * any of the above preceeded by any number of qualifiers, | 26 * * any of the above preceded by any number of qualifiers, |
27 * where a qualifier is a non-private identifier followed by '`.`', | 27 * where a qualifier is a non-private identifier followed by '`.`', |
28 * * or the empty string (the default name of a library with no library | 28 * * or the empty string (the default name of a library with no library |
29 * name declaration). | 29 * name declaration). |
30 * | 30 * |
31 * The following text is non-normative: | 31 * The following text is non-normative: |
32 * | 32 * |
33 * Creating non-const Symbol instances may result in larger output. If | 33 * Creating non-const Symbol instances may result in larger output. If |
34 * possible, use [MirrorsUsed] in "dart:mirrors" to specify which names might | 34 * possible, use [MirrorsUsed] in "dart:mirrors" to specify which names might |
35 * be passed to this constructor. | 35 * be passed to this constructor. |
36 */ | 36 */ |
37 const factory Symbol(String name) = internal.Symbol; | 37 const factory Symbol(String name) = internal.Symbol; |
38 | 38 |
39 /** | 39 /** |
40 * Returns a hash code compatible with [operator==]. | 40 * Returns a hash code compatible with [operator==]. |
41 * | 41 * |
42 * Equal symbols have the same hash code. | 42 * Equal symbols have the same hash code. |
43 */ | 43 */ |
44 int get hashCode; | 44 int get hashCode; |
45 | 45 |
46 /** | 46 /** |
47 * Symbols are equal to other symbols that correspond to the same member name. | 47 * Symbols are equal to other symbols that correspond to the same member name. |
48 * | 48 * |
49 * Qualified member names, like `#foo.bar` are equal only if they have the | 49 * Qualified member names, like `#foo.bar` are equal only if they have the |
50 * same identifiers before the same final member name. | 50 * same identifiers before the same final member name. |
51 */ | 51 */ |
52 bool operator ==(other); | 52 bool operator ==(other); |
53 } | 53 } |
OLD | NEW |