| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 jsAst.Name operator [](Element field) { | 169 jsAst.Name operator [](Element field) { |
| 170 jsAst.Name name = names[field]; | 170 jsAst.Name name = names[field]; |
| 171 if (name == null && superScope != null) return superScope[field]; | 171 if (name == null && superScope != null) return superScope[field]; |
| 172 return name; | 172 return name; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void add(Element field) { | 175 void add(Element field) { |
| 176 if (names.containsKey(field)) return; | 176 if (names.containsKey(field)) return; |
| 177 | 177 |
| 178 jsAst.Name value = _nextName(); | 178 jsAst.Name value = _nextName(); |
| 179 assert(invariant(field, _isNameUnused(value))); | 179 assert(_isNameUnused(value), failedAt(field)); |
| 180 names[field] = value; | 180 names[field] = value; |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool containsField(Element field) => names.containsKey(field); | 183 bool containsField(Element field) => names.containsKey(field); |
| 184 } | 184 } |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * Field names for mixins have two constraints: They need to be unique in the | 187 * Field names for mixins have two constraints: They need to be unique in the |
| 188 * hierarchy of each application of a mixin and they need to be the same for | 188 * hierarchy of each application of a mixin and they need to be the same for |
| 189 * all applications of a mixin. To achieve this, we use global naming for | 189 * all applications of a mixin. To achieve this, we use global naming for |
| (...skipping 35 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 |