| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.namer; | 5 part of js_backend.namer; |
| 6 | 6 |
| 7 abstract class _MinifiedFieldNamer implements Namer { | 7 abstract class _MinifiedFieldNamer implements Namer { |
| 8 _FieldNamingRegistry get fieldRegistry; | 8 _FieldNamingRegistry get fieldRegistry; |
| 9 | 9 |
| 10 // Returns a minimal name for the field that is globally unique along | 10 // Returns a minimal name for the field that is globally unique along |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 * This is achieved at construction time via the [_fieldNameCounter] field that | 90 * This is achieved at construction time via the [_fieldNameCounter] field that |
| 91 * counts the number of fields on the path to the root node that have been | 91 * counts the number of fields on the path to the root node that have been |
| 92 * encountered so far. | 92 * encountered so far. |
| 93 * | 93 * |
| 94 * Obviously, this only works if no fields are added to a parent node after its | 94 * Obviously, this only works if no fields are added to a parent node after its |
| 95 * children have added their first field. | 95 * children have added their first field. |
| 96 */ | 96 */ |
| 97 class _FieldNamingScope { | 97 class _FieldNamingScope { |
| 98 final _FieldNamingScope superScope; | 98 final _FieldNamingScope superScope; |
| 99 final Entity container; | 99 final Entity container; |
| 100 final Map<Element, jsAst.Name> names = new Maplet<Element, jsAst.Name>(); | 100 final Map<Entity, jsAst.Name> names = new Maplet<Entity, jsAst.Name>(); |
| 101 final _FieldNamingRegistry registry; | 101 final _FieldNamingRegistry registry; |
| 102 | 102 |
| 103 /// Naming counter used for fields of ordinary classes. | 103 /// Naming counter used for fields of ordinary classes. |
| 104 int _fieldNameCounter; | 104 int _fieldNameCounter; |
| 105 | 105 |
| 106 /// The number of fields along the superclass chain that use inheritance | 106 /// The number of fields along the superclass chain that use inheritance |
| 107 /// based naming, including the ones allocated for this scope. | 107 /// based naming, including the ones allocated for this scope. |
| 108 int get inheritanceBasedFieldNameCounter => _fieldNameCounter; | 108 int get inheritanceBasedFieldNameCounter => _fieldNameCounter; |
| 109 | 109 |
| 110 /// The number of locally used fields. Depending on the naming source | 110 /// The number of locally used fields. Depending on the naming source |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 : super.rootScope(box, registry); | 225 : super.rootScope(box, registry); |
| 226 | 226 |
| 227 @override | 227 @override |
| 228 bool containsField(_) => true; | 228 bool containsField(_) => true; |
| 229 | 229 |
| 230 jsAst.Name operator [](Element field) { | 230 jsAst.Name operator [](Element field) { |
| 231 if (!names.containsKey(field)) add(field); | 231 if (!names.containsKey(field)) add(field); |
| 232 return names[field]; | 232 return names[field]; |
| 233 } | 233 } |
| 234 } | 234 } |
| OLD | NEW |