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

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

Issue 2994333002: Various redemptions (Closed)
Patch Set: Fix + status updates 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
index f85f1a38c801632c0db932f3fe1ad1d4a545a0d0..39c0107c529f6429eb860ca9590d337f937656e8 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
@@ -28,6 +28,7 @@ typedef void AcceptField(FieldEntity member, js.Name name, js.Name accessorName,
class FieldVisitor {
final CompilerOptions _options;
final ElementEnvironment _elementEnvironment;
+ final CommonElements _commonElements;
final CodegenWorldBuilder _codegenWorldBuilder;
final NativeData _nativeData;
final MirrorsData _mirrorsData;
@@ -37,6 +38,7 @@ class FieldVisitor {
FieldVisitor(
this._options,
this._elementEnvironment,
+ this._commonElements,
this._codegenWorldBuilder,
this._nativeData,
this._mirrorsData,
@@ -46,13 +48,13 @@ class FieldVisitor {
/**
* Invokes [f] for each of the fields of [element].
*
- * [element] must be a [ClassElement] or a [LibraryElement].
+ * [element] must be a [ClassEntity] or a [LibraryEntity].
*
- * If [element] is a [ClassElement], the static fields of the class are
+ * If [element] is a [ClassEntity], the static fields of the class are
* visited if [visitStatics] is true and the instance fields are visited if
* [visitStatics] is false.
*
- * If [element] is a [LibraryElement], [visitStatics] must be true.
+ * If [element] is a [LibraryEntity], [visitStatics] must be true.
*
* When visiting the instance fields of a class, the fields of its superclass
* are also visited if the class is instantiated.
@@ -79,8 +81,8 @@ class FieldVisitor {
isLibrary = true;
assert(visitStatics, failedAt(library));
} else {
- failedAt(NO_LOCATION_SPANNABLE,
- 'Expected a ClassElement or a LibraryElement.');
+ failedAt(
+ NO_LOCATION_SPANNABLE, 'Expected a ClassEntity or a LibraryEntity.');
}
void visitField(FieldEntity field, {ClassEntity holder}) {
@@ -175,10 +177,10 @@ class FieldVisitor {
field is ClosureFieldElement;
}
- bool canAvoidGeneratedCheckedSetter(FieldElement member) {
+ bool canAvoidGeneratedCheckedSetter(FieldEntity member) {
// We never generate accessors for top-level/static fields.
if (!member.isInstanceMember) return true;
- ResolutionDartType type = member.type;
- return type.treatAsDynamic || type.isObject;
+ DartType type = _elementEnvironment.getFieldType(member);
+ return type.treatAsDynamic || type == _commonElements.objectType;
}
}

Powered by Google App Engine
This is Rietveld 408576698