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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 | 466 |
467 /** | 467 /** |
468 * Returns name of accessor (root to getter and setter) for an instance field. | 468 * Returns name of accessor (root to getter and setter) for an instance field. |
469 */ | 469 */ |
470 String instanceFieldAccessorName(Element element) { | 470 String instanceFieldAccessorName(Element element) { |
471 String proposedName = privateName(element.getLibrary(), element.name); | 471 String proposedName = privateName(element.getLibrary(), element.name); |
472 return getMappedInstanceName(proposedName); | 472 return getMappedInstanceName(proposedName); |
473 } | 473 } |
474 | 474 |
| 475 String readTypeVariableName(TypeVariableElement element) { |
| 476 return '\$tv_${instanceFieldAccessorName(element)}'; |
| 477 } |
| 478 |
475 /** | 479 /** |
476 * Returns name of the JavaScript property used to store an instance field. | 480 * Returns name of the JavaScript property used to store an instance field. |
477 */ | 481 */ |
478 String instanceFieldPropertyName(Element element) { | 482 String instanceFieldPropertyName(Element element) { |
479 if (element.hasFixedBackendName()) { | 483 if (element.hasFixedBackendName()) { |
480 return element.fixedBackendName(); | 484 return element.fixedBackendName(); |
481 } | 485 } |
482 // If a class is used anywhere as a mixin, we must make the name unique so | 486 // If a class is used anywhere as a mixin, we must make the name unique so |
483 // that it does not accidentally shadow. Also, the mixin name must be | 487 // that it does not accidentally shadow. Also, the mixin name must be |
484 // constant over all mixins. | 488 // constant over all mixins. |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 if (!first) { | 1380 if (!first) { |
1377 sb.write('_'); | 1381 sb.write('_'); |
1378 } | 1382 } |
1379 sb.write('_'); | 1383 sb.write('_'); |
1380 visit(link.head); | 1384 visit(link.head); |
1381 first = true; | 1385 first = true; |
1382 } | 1386 } |
1383 } | 1387 } |
1384 } | 1388 } |
1385 } | 1389 } |
OLD | NEW |