Chromium Code Reviews| Index: pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart |
| diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart |
| index 6722d9840fd7ab7cc42a1f88e8b000ec9dbb94d9..7bdf10aac55d0cbb15b3b22c4adc9b66cb890c0a 100644 |
| --- a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart |
| +++ b/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart |
| @@ -15,6 +15,9 @@ part of dart._internal; |
| class Symbol implements core.Symbol { |
| final String _name; |
| + // Used internally by DDC to map ES6 symbols to Dart. |
| + final dynamic _nativeSymbol; |
| + |
| /** |
| * Source of RegExp matching Dart reserved words. |
| * |
| @@ -99,18 +102,21 @@ class Symbol implements core.Symbol { |
| '^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$'); |
| external const Symbol(String name); |
| + |
| + external const Symbol.es6(String name, nativeSymbol); |
| /** |
| * Platform-private method used by the mirror system to create |
| * otherwise invalid names. |
| */ |
| - const Symbol.unvalidated(this._name); |
| + const Symbol.unvalidated(this._name) : this._nativeSymbol = null; |
| // This is called by dart2js. |
| Symbol.validated(String name) |
| - : this._name = validatePublicSymbol(name); |
| + : this._name = validatePublicSymbol(name), this._nativeSymbol = null; |
| - bool operator ==(Object other) => other is Symbol && _name == other._name; |
| + bool operator ==(Object other) => other is Symbol && _name == other._name |
| + && _nativeSymbol == other._nativeSymbol; |
|
Bob Nystrom
2016/11/29 21:28:13
Run dartfmt?
vsm
2016/11/29 21:41:05
Done.
|
| external int get hashCode; |
| @@ -119,6 +125,8 @@ class Symbol implements core.Symbol { |
| /// Platform-private accessor which cannot be called from user libraries. |
| static String getName(Symbol symbol) => symbol._name; |
| + static dynamic getNativeSymbol(Symbol symbol) => symbol._nativeSymbol; |
| + |
| static String validatePublicSymbol(String name) { |
| if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name; |
| if (name.startsWith('_')) { |