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

Unified Diff: lib/src/codegen/js_field_storage.dart

Issue 1492523004: Fixes #378 (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Use virtual fields for extension fields Created 5 years 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/collection/src/comparators.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/js_field_storage.dart
diff --git a/lib/src/codegen/js_field_storage.dart b/lib/src/codegen/js_field_storage.dart
index 887714216a1a6ce4a4431681744d95690cbad0f2..773a54b152a7c1777bb7204127dc1be4fb96ddfa 100644
--- a/lib/src/codegen/js_field_storage.dart
+++ b/lib/src/codegen/js_field_storage.dart
@@ -12,14 +12,16 @@ import '../info.dart' show LibraryUnit;
/// We use a storage slot for fields that override or can be overridden by
/// getter/setter pairs.
-HashSet<FieldElement> findFieldsNeedingStorage(LibraryUnit library) {
+HashSet<FieldElement> findFieldsNeedingStorage(
+ LibraryUnit library, HashSet<ClassElement> extensionTypes) {
var overrides = new HashSet<FieldElement>();
for (var unit in library.partsThenLibrary) {
for (var cls in unit.element.types) {
var superclasses = getSuperclasses(cls);
for (var field in cls.fields) {
if (!field.isSynthetic && !overrides.contains(field)) {
- checkForPropertyOverride(field, superclasses, overrides);
+ checkForPropertyOverride(
+ field, superclasses, overrides, extensionTypes);
}
}
}
@@ -28,8 +30,11 @@ HashSet<FieldElement> findFieldsNeedingStorage(LibraryUnit library) {
return overrides;
}
-void checkForPropertyOverride(FieldElement field,
- List<ClassElement> superclasses, HashSet<FieldElement> overrides) {
+void checkForPropertyOverride(
+ FieldElement field,
+ List<ClassElement> superclasses,
+ HashSet<FieldElement> overrides,
+ HashSet<ClassElement> extensionTypes) {
assert(!field.isSynthetic);
var library = field.library;
@@ -41,7 +46,8 @@ void checkForPropertyOverride(FieldElement field,
// If we find an abstract getter/setter pair, stop the search.
var getter = superprop.getter;
var setter = superprop.setter;
- if ((getter == null || getter.isAbstract) &&
+ if (!extensionTypes.contains(superclass) &&
+ (getter == null || getter.isAbstract) &&
(setter == null || setter.isAbstract)) {
break;
}
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/collection/src/comparators.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698