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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_names.dart

Issue 1436263002: dart2js: Forbid # placeholders in JS function bodies. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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: sdk/lib/_internal/js_runtime/lib/js_names.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_names.dart b/sdk/lib/_internal/js_runtime/lib/js_names.dart
index 708b873b7e5deed4e18bb17dbd499d77b1ea08fa..a0fe67f83f49e93a30c4021938b9aaa95929efbf 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_names.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_names.dart
@@ -165,9 +165,14 @@ String unmangleGlobalNameIfPreservedAnyways(String name) {
}
String unmangleAllIdentifiersIfPreservedAnyways(String str) {
- return JS("String",
- r"(#).replace(/[^<,> ]+/g,"
- r"function(m) { return #[m] || m; })",
- str,
- JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES));
-}
+ return JS(
+ 'String',
+ r'''
+ (function(str, names) {
+ return str.replace(
+ /[^<,> ]+/g,
+ function(m) { return names[m] || m; });
+ })(#, #)''',
+ str,
+ JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES));
+}
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_mirrors.dart ('k') | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698