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 js_backend; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
9 */ | 9 */ |
10 class Namer { | 10 class Namer { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return '$closureInvocationSelectorName\$${selector.argumentCount}$buffer'; | 204 return '$closureInvocationSelectorName\$${selector.argumentCount}$buffer'; |
205 } | 205 } |
206 return getMappedInstanceName( | 206 return getMappedInstanceName( |
207 '${privateName(lib, name)}\$${selector.argumentCount}$buffer'); | 207 '${privateName(lib, name)}\$${selector.argumentCount}$buffer'); |
208 } | 208 } |
209 | 209 |
210 /** | 210 /** |
211 * Returns the internal name used for an invocation mirror of this selector. | 211 * Returns the internal name used for an invocation mirror of this selector. |
212 */ | 212 */ |
213 String invocationMirrorInternalName(Selector selector) { | 213 String invocationMirrorInternalName(Selector selector) { |
214 String nameString = selector.name.slowToString(); | |
215 if (selector.isGetter()) { | 214 if (selector.isGetter()) { |
216 return getterName(selector.library, selector.name); | 215 return getterName(selector.library, selector.name); |
217 } else if (selector.isSetter()) { | 216 } else if (selector.isSetter()) { |
218 return setterName(selector.library, selector.name); | 217 return setterName(selector.library, selector.name); |
219 } else { | 218 } else { |
220 return instanceMethodInvocationName( | 219 return instanceMethodInvocationName( |
221 selector.library, selector.name, selector); | 220 selector.library, selector.name, selector); |
222 } | 221 } |
223 } | 222 } |
224 | 223 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 474 } |
476 | 475 |
477 String safeName(String name) { | 476 String safeName(String name) { |
478 if (jsReserved.contains(name) || name.startsWith('\$')) { | 477 if (jsReserved.contains(name) || name.startsWith('\$')) { |
479 name = "\$$name"; | 478 name = "\$$name"; |
480 assert(!jsReserved.contains(name)); | 479 assert(!jsReserved.contains(name)); |
481 } | 480 } |
482 return name; | 481 return name; |
483 } | 482 } |
484 } | 483 } |
OLD | NEW |