Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart

Issue 2535273002: Better mirrors support for mixins and private fields (Closed)
Patch Set: More fixes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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('_')) {

Powered by Google App Engine
This is Rietveld 408576698