| 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 MinifyNamer extends Namer { | 10 class MinifyNamer extends Namer { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 * all applications of a mixin. To achieve this, we use global naming for | 405 * all applications of a mixin. To achieve this, we use global naming for |
| 406 * mixins from the same name pool as fields and add a `$` at the end to ensure | 406 * mixins from the same name pool as fields and add a `$` at the end to ensure |
| 407 * they do not collide with normal field names. The `$` sign is typically used | 407 * they do not collide with normal field names. The `$` sign is typically used |
| 408 * as a separator between method names and argument counts and does not appear | 408 * as a separator between method names and argument counts and does not appear |
| 409 * in generated names themselves. | 409 * in generated names themselves. |
| 410 */ | 410 */ |
| 411 class _MixinFieldNamingScope extends _FieldNamingScope { | 411 class _MixinFieldNamingScope extends _FieldNamingScope { |
| 412 int get _localFieldNameCounter => registry.globalCount; | 412 int get _localFieldNameCounter => registry.globalCount; |
| 413 void set _localFieldNameCounter(int val) { registry.globalCount = val; } | 413 void set _localFieldNameCounter(int val) { registry.globalCount = val; } |
| 414 | 414 |
| 415 Map<Element, String> get names => registry.globalNames; | 415 Map<Entity, String> get names => registry.globalNames; |
| 416 | 416 |
| 417 _MixinFieldNamingScope.mixin(ClassElement cls, _FieldNamingRegistry registry) | 417 _MixinFieldNamingScope.mixin(ClassElement cls, _FieldNamingRegistry registry) |
| 418 : super.rootScope(cls, registry); | 418 : super.rootScope(cls, registry); |
| 419 | 419 |
| 420 _MixinFieldNamingScope.mixedIn(MixinApplicationElement container, | 420 _MixinFieldNamingScope.mixedIn(MixinApplicationElement container, |
| 421 _FieldNamingScope superScope, _FieldNamingRegistry registry) | 421 _FieldNamingScope superScope, _FieldNamingRegistry registry) |
| 422 : super.inherit(container, superScope, registry); | 422 : super.inherit(container, superScope, registry); |
| 423 | 423 |
| 424 String _nextName() { | 424 String _nextName() { |
| 425 var proposed = super._nextName(); | 425 var proposed = super._nextName(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 437 _BoxFieldNamingScope(Local box, _FieldNamingRegistry registry) : | 437 _BoxFieldNamingScope(Local box, _FieldNamingRegistry registry) : |
| 438 super.rootScope(box, registry); | 438 super.rootScope(box, registry); |
| 439 | 439 |
| 440 bool containsField(_) => true; | 440 bool containsField(_) => true; |
| 441 | 441 |
| 442 String operator[](Element field) { | 442 String operator[](Element field) { |
| 443 if (!names.containsKey(field)) add(field); | 443 if (!names.containsKey(field)) add(field); |
| 444 return names[field]; | 444 return names[field]; |
| 445 } | 445 } |
| 446 } | 446 } |
| OLD | NEW |