Index: pkg/compiler/lib/src/js_backend/namer.dart |
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart |
index 52eaa5591b44c3be529537b2df96bd9e34670b12..a5b21318606b222973b2e078900ebfb7e93ac1b9 100644 |
--- a/pkg/compiler/lib/src/js_backend/namer.dart |
+++ b/pkg/compiler/lib/src/js_backend/namer.dart |
@@ -1286,9 +1286,11 @@ class Namer { |
/// Returns a proposed name for the given typedef or class [element]. |
/// The returned id is guaranteed to be a valid JavaScript identifier. |
String _proposeNameForType(Entity element) { |
- return element.name.replaceAll('+', '_'); |
+ return element.name.replaceAll(_nonIdentifierRE, '_'); |
} |
+ static RegExp _nonIdentifierRE = new RegExp(r'[^A-Za-z0-9_$]'); |
+ |
/// Returns a proposed name for the given top-level or static member |
/// [element]. The returned id is guaranteed to be a valid JavaScript |
/// identifier. |