| Index: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| index 69817be1aaa4dd5b84f84382cdf2a1d0f4366d75..e66b8c0486f36d6ebe16c3f00cfaa0591ec25919 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
| @@ -208,7 +208,7 @@ class Namer {
|
| * Returns a preferred JS-id for the given top-level or static element.
|
| * The returned id is guaranteed to be a valid JS-id.
|
| */
|
| - String _computeGuess(Element element) {
|
| + String _computeGuess(Element element, bool allowUnsafeName) {
|
| assert(!element.isInstanceMember());
|
| LibraryElement lib = element.getLibrary();
|
| String name;
|
| @@ -232,8 +232,8 @@ class Namer {
|
| } else {
|
| name = element.name.slowToString();
|
| }
|
| - // Prefix the name with '$' if it is reserved.
|
| - return safeName(name);
|
| + // Prefix the name with '$' if it is reserved and we generate safe names.
|
| + return allowUnsafeName ? name : safeName(name);
|
| }
|
|
|
| String getBailoutName(Element element) {
|
| @@ -248,7 +248,7 @@ class Namer {
|
| * For accessing statics consider calling
|
| * [isolateAccess]/[isolateBailoutAccess] or [isolatePropertyAccess] instead.
|
| */
|
| - String getName(Element element) {
|
| + String getName(Element element, {bool allowUnsafeName: false}) {
|
| if (element.isInstanceMember()) {
|
| if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY
|
| || element.kind == ElementKind.FUNCTION) {
|
| @@ -266,12 +266,11 @@ class Namer {
|
| } else {
|
| // Use declaration element to ensure invariant on [globals].
|
| element = element.declaration;
|
| -
|
| // Dealing with a top-level or static element.
|
| String cached = globals[element];
|
| if (cached != null) return cached;
|
|
|
| - String guess = _computeGuess(element);
|
| + String guess = _computeGuess(element, allowUnsafeName);
|
| ElementKind kind = element.kind;
|
| if (identical(kind, ElementKind.VARIABLE) ||
|
| identical(kind, ElementKind.PARAMETER)) {
|
|
|