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

Side by Side Diff: frog/leg/ssa/js_names.dart

Issue 9465041: Better mangling in frog for fixing parts of issue 1837. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/lang.dart ('k') | frog/member.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class JsNames { 5 class JsNames {
6 static final javaScriptKeywords = const <String>[ 6 static final javaScriptKeywords = const <String>[
7 // These are current keywords 7 // These are current keywords
8 "break", "delete", "function", "return", "typeof", "case", "do", "if", 8 "break", "delete", "function", "return", "typeof", "case", "do", "if",
9 "switch", "var", "catch", "else", "in", "this", "void", "continue", 9 "switch", "var", "catch", "else", "in", "this", "void", "continue",
10 "false", "instanceof", "throw", "while", "debugger", "finally", "new", 10 "false", "instanceof", "throw", "while", "debugger", "finally", "new",
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 // TODO(ngeoffray): only the namer should call this method. 168 // TODO(ngeoffray): only the namer should call this method.
169 // Eventually move it there. 169 // Eventually move it there.
170 /* 170 /*
171 * Returns a name that does not clash with reserved JS keywords, 171 * Returns a name that does not clash with reserved JS keywords,
172 * and also ensures it won't clash with other identifiers. 172 * and also ensures it won't clash with other identifiers.
173 */ 173 */
174 static String getValid(String name) { 174 static String getValid(String name) {
175 if (reserved.contains(name)) { 175 if (reserved.contains(name)) {
176 name = '\$$name'; 176 return getValid('\$$name');
177 assert(!reserved.contains(name));
178 } else if (name.contains(@'$')) { 177 } else if (name.contains(@'$')) {
179 name = name.replaceAll(@'$', @'$$'); 178 name = name.replaceAll(@'$', @'$$');
180 } 179 }
181 return name; 180 return name;
182 } 181 }
183 } 182 }
OLDNEW
« no previous file with comments | « frog/lang.dart ('k') | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698