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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 /// The number of locally used fields. Depending on the naming source | 112 /// The number of locally used fields. Depending on the naming source |
113 /// (e.g. inheritance based or globally unique for mixixns) this | 113 /// (e.g. inheritance based or globally unique for mixixns) this |
114 /// might be different from [inheritanceBasedFieldNameCounter]. | 114 /// might be different from [inheritanceBasedFieldNameCounter]. |
115 int get _localFieldNameCounter => _fieldNameCounter; | 115 int get _localFieldNameCounter => _fieldNameCounter; |
116 void set _localFieldNameCounter(int val) { | 116 void set _localFieldNameCounter(int val) { |
117 _fieldNameCounter = val; | 117 _fieldNameCounter = val; |
118 } | 118 } |
119 | 119 |
120 factory _FieldNamingScope.forClass( | 120 factory _FieldNamingScope.forClass( |
121 ClassElement cls, ClassWorld world, _FieldNamingRegistry registry) { | 121 ClassElement cls, ClosedWorld world, _FieldNamingRegistry registry) { |
122 _FieldNamingScope result = registry.scopes[cls]; | 122 _FieldNamingScope result = registry.scopes[cls]; |
123 if (result != null) return result; | 123 if (result != null) return result; |
124 | 124 |
125 if (world.isUsedAsMixin(cls)) { | 125 if (world.isUsedAsMixin(cls)) { |
126 result = new _MixinFieldNamingScope.mixin(cls, registry); | 126 result = new _MixinFieldNamingScope.mixin(cls, registry); |
127 } else { | 127 } else { |
128 if (cls.superclass == null) { | 128 if (cls.superclass == null) { |
129 result = new _FieldNamingScope.rootScope(cls, registry); | 129 result = new _FieldNamingScope.rootScope(cls, registry); |
130 } else { | 130 } else { |
131 _FieldNamingScope superScope = | 131 _FieldNamingScope superScope = |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 : super.rootScope(box, registry); | 227 : super.rootScope(box, registry); |
228 | 228 |
229 @override | 229 @override |
230 bool containsField(_) => true; | 230 bool containsField(_) => true; |
231 | 231 |
232 jsAst.Name operator [](Element field) { | 232 jsAst.Name operator [](Element field) { |
233 if (!names.containsKey(field)) add(field); | 233 if (!names.containsKey(field)) add(field); |
234 return names[field]; | 234 return names[field]; |
235 } | 235 } |
236 } | 236 } |
OLD | NEW |