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 implements ClosureNamer { | 10 class Namer implements ClosureNamer { |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 467 } |
468 | 468 |
469 /** | 469 /** |
470 * Returns name of accessor (root to getter and setter) for an instance field. | 470 * Returns name of accessor (root to getter and setter) for an instance field. |
471 */ | 471 */ |
472 String instanceFieldAccessorName(Element element) { | 472 String instanceFieldAccessorName(Element element) { |
473 String proposedName = privateName(element.getLibrary(), element.name); | 473 String proposedName = privateName(element.getLibrary(), element.name); |
474 return getMappedInstanceName(proposedName); | 474 return getMappedInstanceName(proposedName); |
475 } | 475 } |
476 | 476 |
| 477 String readTypeVariableName(TypeVariableElement element) { |
| 478 return '\$tv_${instanceFieldAccessorName(element)}'; |
| 479 } |
| 480 |
477 /** | 481 /** |
478 * Returns name of the JavaScript property used to store an instance field. | 482 * Returns name of the JavaScript property used to store an instance field. |
479 */ | 483 */ |
480 String instanceFieldPropertyName(Element element) { | 484 String instanceFieldPropertyName(Element element) { |
481 if (element.hasFixedBackendName()) { | 485 if (element.hasFixedBackendName()) { |
482 return element.fixedBackendName(); | 486 return element.fixedBackendName(); |
483 } | 487 } |
484 // If a class is used anywhere as a mixin, we must make the name unique so | 488 // If a class is used anywhere as a mixin, we must make the name unique so |
485 // that it does not accidentally shadow. Also, the mixin name must be | 489 // that it does not accidentally shadow. Also, the mixin name must be |
486 // constant over all mixins. | 490 // constant over all mixins. |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 if (!first) { | 1392 if (!first) { |
1389 sb.write('_'); | 1393 sb.write('_'); |
1390 } | 1394 } |
1391 sb.write('_'); | 1395 sb.write('_'); |
1392 visit(link.head); | 1396 visit(link.head); |
1393 first = true; | 1397 first = true; |
1394 } | 1398 } |
1395 } | 1399 } |
1396 } | 1400 } |
1397 } | 1401 } |
OLD | NEW |