| 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._internal; | 5 part of dart._internal; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Implementation of [core.Symbol]. This class uses the same name as | 8 * Implementation of [core.Symbol]. This class uses the same name as |
| 9 * a core class so a user can't tell the difference. | 9 * a core class so a user can't tell the difference. |
| 10 * | 10 * |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * RegExp that validates a non-empty symbol. | 91 * RegExp that validates a non-empty symbol. |
| 92 * | 92 * |
| 93 * Private symbols are accepted. | 93 * Private symbols are accepted. |
| 94 * | 94 * |
| 95 * The empty symbol is handled before this regexp is used, and is not | 95 * The empty symbol is handled before this regexp is used, and is not |
| 96 * accepted. | 96 * accepted. |
| 97 */ | 97 */ |
| 98 static final RegExp symbolPattern = new RegExp( | 98 static final RegExp symbolPattern = new RegExp( |
| 99 '^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$'); | 99 '^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$'); |
| 100 | 100 |
| 101 @patch | |
| 102 const Symbol(String name) | 101 const Symbol(String name) |
| 103 : this._name = name; | 102 : this._name = name; |
| 104 | 103 |
| 105 /** | 104 /** |
| 106 * Platform-private method used by the mirror system to create | 105 * Platform-private method used by the mirror system to create |
| 107 * otherwise invalid names. | 106 * otherwise invalid names. |
| 108 */ | 107 */ |
| 109 const Symbol.unvalidated(this._name); | 108 const Symbol.unvalidated(this._name); |
| 110 | 109 |
| 111 // This is called by dart2js. | 110 // This is called by dart2js. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 138 | 137 |
| 139 /** | 138 /** |
| 140 * Checks whether name is a valid symbol name. | 139 * Checks whether name is a valid symbol name. |
| 141 * | 140 * |
| 142 * This test allows both private and non-private symbols. | 141 * This test allows both private and non-private symbols. |
| 143 */ | 142 */ |
| 144 static bool isValidSymbol(String name) { | 143 static bool isValidSymbol(String name) { |
| 145 return (name.isEmpty || symbolPattern.hasMatch(name)); | 144 return (name.isEmpty || symbolPattern.hasMatch(name)); |
| 146 } | 145 } |
| 147 } | 146 } |
| OLD | NEW |