OLD | NEW |
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 part of ssa; | |
6 | |
7 class JsNames { | 5 class JsNames { |
8 static const javaScriptKeywords = const <String>[ | 6 static const javaScriptKeywords = const <String>[ |
9 // These are current keywords | 7 // These are current keywords |
10 "break", "delete", "function", "return", "typeof", "case", "do", "if", | 8 "break", "delete", "function", "return", "typeof", "case", "do", "if", |
11 "switch", "var", "catch", "else", "in", "this", "void", "continue", | 9 "switch", "var", "catch", "else", "in", "this", "void", "continue", |
12 "false", "instanceof", "throw", "while", "debugger", "finally", "new", | 10 "false", "instanceof", "throw", "while", "debugger", "finally", "new", |
13 "true", "with", "default", "for", "null", "try", | 11 "true", "with", "default", "for", "null", "try", |
14 | 12 |
15 // These are future keywords | 13 // These are future keywords |
16 "abstract", "double", "goto", "native", "static", "boolean", "enum", | 14 "abstract", "double", "goto", "native", "static", "boolean", "enum", |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 static String getValid(String name) { | 174 static String getValid(String name) { |
177 if (reserved.contains(name)) { | 175 if (reserved.contains(name)) { |
178 name = '$name\$'; | 176 name = '$name\$'; |
179 assert(!reserved.contains(name)); | 177 assert(!reserved.contains(name)); |
180 } else if (name.contains(r'$')) { | 178 } else if (name.contains(r'$')) { |
181 name = name.replaceAll(r'$', r'$$'); | 179 name = name.replaceAll(r'$', r'$$'); |
182 } | 180 } |
183 return name; | 181 return name; |
184 } | 182 } |
185 } | 183 } |
OLD | NEW |