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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart

Issue 2936063002: Handle named mixin application in emitter (Closed)
Patch Set: Created 3 years, 6 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
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 dart2js.js_emitter.program_builder; 5 part of dart2js.js_emitter.program_builder;
6 6
7 /** 7 /**
8 * [member] is a field (instance, static, or top level). 8 * [member] is a field (instance, static, or top level).
9 * 9 *
10 * [name] is the field name that the [Namer] has picked for this field's 10 * [name] is the field name that the [Namer] has picked for this field's
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 isLibrary = true; 79 isLibrary = true;
80 assert(visitStatics, failedAt(library)); 80 assert(visitStatics, failedAt(library));
81 } else { 81 } else {
82 throw new SpannableAssertionFailure(NO_LOCATION_SPANNABLE, 82 throw new SpannableAssertionFailure(NO_LOCATION_SPANNABLE,
83 'Expected a ClassElement or a LibraryElement.'); 83 'Expected a ClassElement or a LibraryElement.');
84 } 84 }
85 85
86 void visitField(FieldEntity field, {ClassEntity holder}) { 86 void visitField(FieldEntity field, {ClassEntity holder}) {
87 assert(!(field is FieldElement && !field.isDeclaration), failedAt(field)); 87 assert(!(field is FieldElement && !field.isDeclaration), failedAt(field));
88 88
89 bool isMixinNativeField = isNativeClass && 89 bool isMixinNativeField =
90 _elementEnvironment.isUnnamedMixinApplication(holder); 90 isNativeClass && _elementEnvironment.isMixinApplication(holder);
91 91
92 // See if we can dynamically create getters and setters. 92 // See if we can dynamically create getters and setters.
93 // We can only generate getters and setters for [element] since 93 // We can only generate getters and setters for [element] since
94 // the fields of super classes could be overwritten with getters or 94 // the fields of super classes could be overwritten with getters or
95 // setters. 95 // setters.
96 bool needsGetter = false; 96 bool needsGetter = false;
97 bool needsSetter = false; 97 bool needsSetter = false;
98 if (isLibrary || isMixinNativeField || holder == cls) { 98 if (isLibrary || isMixinNativeField || holder == cls) {
99 needsGetter = fieldNeedsGetter(field); 99 needsGetter = fieldNeedsGetter(field);
100 needsSetter = fieldNeedsSetter(field); 100 needsSetter = fieldNeedsSetter(field);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 field is ClosureFieldElement; 175 field is ClosureFieldElement;
176 } 176 }
177 177
178 bool canAvoidGeneratedCheckedSetter(FieldElement member) { 178 bool canAvoidGeneratedCheckedSetter(FieldElement member) {
179 // We never generate accessors for top-level/static fields. 179 // We never generate accessors for top-level/static fields.
180 if (!member.isInstanceMember) return true; 180 if (!member.isInstanceMember) return true;
181 ResolutionDartType type = member.type; 181 ResolutionDartType type = member.type;
182 return type.treatAsDynamic || type.isObject; 182 return type.treatAsDynamic || type.isObject;
183 } 183 }
184 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698