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

Unified Diff: frog/world.dart

Issue 8763001: Fix names with '$' to not conflict with operators or internal helpers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged again Created 9 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
« no previous file with comments | « frog/value.dart ('k') | tests/language/src/NamingTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/world.dart
diff --git a/frog/world.dart b/frog/world.dart
index 8fae0ac10ec5794e7f3146907e98961607e5a1f4..520d26d0940f1189e860457a333bfb532e9e79cd 100644
--- a/frog/world.dart
+++ b/frog/world.dart
@@ -229,6 +229,7 @@ class World {
/** Ensures that identifiers are legal in the generated JS. */
String toJsIdentifier(String name) {
+ if (name == null) return null;
if (_jsKeywords == null) {
// TODO(jmesserly): this doesn't work if I write "new Set<String>.from"
// List of JS reserved words.
@@ -245,8 +246,8 @@ class World {
if (_jsKeywords.contains(name)) {
return name + '_';
} else {
- // regexs here? Is it worth checking all names - or just libraries?
- return name;
+ // regexs for better perf?
+ return name.replaceAll(@'$', @'$$').replaceAll(':', @'$');
}
}
« no previous file with comments | « frog/value.dart ('k') | tests/language/src/NamingTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698