Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: pkg/compiler/lib/src/js_backend/field_naming_mixin.dart

Issue 2994353002: Fix the locals lookup of variables and partial implementation of boxing of variables.
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/js_model/closure.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // the given element's class inheritance chain. 11 // the given element's class inheritance chain.
12 // 12 //
13 // The inheritance scope based naming might not yield a name. For instance, 13 // The inheritance scope based naming might not yield a name. For instance,
14 // this could be because the field belongs to a mixin. In such a case this 14 // this could be because the field belongs to a mixin. In such a case this
15 // will return `null` and a normal field name has to be used. 15 // will return `null` and a normal field name has to be used.
16 jsAst.Name _minifiedInstanceFieldPropertyName(FieldEntity element) { 16 jsAst.Name _minifiedInstanceFieldPropertyName(FieldEntity element) {
17 if (_nativeData.hasFixedBackendName(element)) { 17 if (_nativeData.hasFixedBackendName(element)) {
18 return new StringBackedName(_nativeData.getFixedBackendName(element)); 18 return new StringBackedName(_nativeData.getFixedBackendName(element));
19 } 19 }
20 20
21 _FieldNamingScope names; 21 _FieldNamingScope names;
22 if (element is BoxFieldElement) { 22 if (element is BoxFieldElement) {
23 names = new _FieldNamingScope.forBox(element.box, fieldRegistry); 23 names = new _FieldNamingScope.forBox(element.box, fieldRegistry);
24 } else if (element is JBoxedField) { 24 } else if (element is JRecord) {
25 names = new _FieldNamingScope.forBox(element.box, fieldRegistry); 25 names = new _FieldNamingScope.forBox(element.box, fieldRegistry);
26 } else { 26 } else {
27 ClassEntity cls = element.enclosingClass; 27 ClassEntity cls = element.enclosingClass;
28 names = new _FieldNamingScope.forClass(cls, _closedWorld, fieldRegistry); 28 names = new _FieldNamingScope.forClass(cls, _closedWorld, fieldRegistry);
29 } 29 }
30 30
31 if (names.containsField(element)) { 31 if (names.containsField(element)) {
32 return names[element]; 32 return names[element];
33 } 33 }
34 return null; 34 return null;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 : super.rootScope(box, registry); 231 : super.rootScope(box, registry);
232 232
233 @override 233 @override
234 bool containsField(_) => true; 234 bool containsField(_) => true;
235 235
236 jsAst.Name operator [](Entity field) { 236 jsAst.Name operator [](Entity field) {
237 if (!names.containsKey(field)) add(field); 237 if (!names.containsKey(field)) add(field);
238 return names[field]; 238 return names[field];
239 } 239 }
240 } 240 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/js_model/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698