Chromium Code Reviews| Index: dart/runtime/lib/symbol_patch.dart |
| diff --git a/dart/runtime/lib/symbol_patch.dart b/dart/runtime/lib/symbol_patch.dart |
| index 67713487371ad5a5843055b030a3f6b09f229c1e..d46cbf6dbfca357b24be6cac722c03d3f8029919 100644 |
| --- a/dart/runtime/lib/symbol_patch.dart |
| +++ b/dart/runtime/lib/symbol_patch.dart |
| @@ -9,27 +9,51 @@ patch class Symbol { |
| static final RegExp _validationPattern = |
| - new RegExp(r'^[a-zA-Z$][a-zA-Z$0-9_]*=?'); |
| + new RegExp(r'^(?:[a-zA-Z$][a-zA-Z$0-9_]*=?|' |
| + r'-|' |
| + r'\[\]=|' |
| + r'~|' |
| + r'==|' |
| + r'\[\]|' |
| + r'\*|' |
| + r'/|' |
| + r'%|' |
| + r'~/|' |
| + r'\+|' |
| + r'<<|' |
| + r'>>|' |
| + r'>=|' |
| + r'>|' |
| + r'<=|' |
| + r'<|' |
| + r'&|' |
| + r'\^|' |
| + r'\|' |
| + r')'); |
| static _validate(String name) { |
| if (name is! String) throw new ArgumentError('name must be a String'); |
| - if (name.isEmpty) return; |
| + if (name.isEmpty) return name; |
|
ahe
2013/04/11 20:12:27
Note to self: I need to update the symbol_test.dar
ahe
2013/04/15 12:34:02
Done.
|
| if (name.startsWith('_')) { |
| throw new ArgumentError('"$name" is a private identifier'); |
| } |
| if (!_validationPattern.hasMatch(name)) { |
| throw new ArgumentError( |
| - '"$name" is not an identifier or an empty String'); |
| + '"$name" is not an identifier or an empty String'); |
| } |
| return name; |
| } |
| /* patch */ bool operator ==(other) { |
| - return other is Symbol && _name == other._name; |
| + return other is Symbol && |
| + Symbol == other.runtimeType && |
| + _name == other._name; |
| } |
| /* patch */ int get hashCode { |
| const arbitraryPrime = 664597; |
| return 0x1fffffff & (arbitraryPrime * _name.hashCode); |
| } |
| + |
| + /* patch */ static String getName(Symbol symbol) => symbol._name; |
|
ahe
2013/04/11 20:12:27
I should not submit this change.
Ivan Posva
2013/04/12 04:16:18
Why not?
ahe
2013/04/15 12:34:02
Because this method needs to be in the mirror API,
|
| } |