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

Unified Diff: pkg/compiler/lib/src/serialization/impact_serialization.dart

Issue 1901683002: Support deserialization of ResolutionImpact for members of unnamed mixin applications (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/serialization/impact_serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/impact_serialization.dart b/pkg/compiler/lib/src/serialization/impact_serialization.dart
index 04168888bf2d19abd0b074fd6b16b61400af9f7e..7e74259bf912d0b1411128905fa9437cfd44294c 100644
--- a/pkg/compiler/lib/src/serialization/impact_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/impact_serialization.dart
@@ -4,6 +4,7 @@
library dart2js.serialization.impact;
+import '../common.dart';
import '../common/resolution.dart';
import '../constants/expressions.dart';
import '../dart_types.dart';
@@ -19,12 +20,13 @@ import 'serialization_util.dart';
/// Visitor that serializes a [ResolutionImpact] object using an
/// [ObjectEncoder].
class ImpactSerializer implements WorldImpactVisitor {
+ final Element element;
final ObjectEncoder objectEncoder;
final ListEncoder staticUses;
final ListEncoder dynamicUses;
final ListEncoder typeUses;
- ImpactSerializer(ObjectEncoder objectEncoder)
+ ImpactSerializer(this.element, ObjectEncoder objectEncoder)
: this.objectEncoder = objectEncoder,
staticUses = objectEncoder.createList(Key.STATIC_USES),
dynamicUses = objectEncoder.createList(Key.DYNAMIC_USES),
@@ -64,14 +66,10 @@ class ImpactSerializer implements WorldImpactVisitor {
@override
void visitStaticUse(StaticUse staticUse) {
- if (staticUse.element.isGenerativeConstructor &&
- staticUse.element.enclosingClass.isUnnamedMixinApplication) {
- // TODO(johnniwinther): Handle static use of forwarding constructors.
- return;
- }
ObjectEncoder object = staticUses.createObject();
object.setEnum(Key.KIND, staticUse.kind);
- object.setElement(Key.ELEMENT, staticUse.element);
+ serializeElementReference(
+ element, Key.ELEMENT, Key.NAME, object, staticUse.element);
}
@override
@@ -95,29 +93,35 @@ class DeserializedResolutionImpact extends WorldImpact
final Iterable<TypeUse> typeUses;
DeserializedResolutionImpact(
- {this.constSymbolNames,
- this.constantLiterals,
- this.dynamicUses,
+ {this.constSymbolNames: const <String>[],
+ this.constantLiterals: const <ConstantExpression>[],
+ this.dynamicUses: const <DynamicUse>[],
EnumSet<Feature> features,
- this.listLiterals,
- this.mapLiterals,
- this.staticUses,
- this.typeUses})
+ this.listLiterals: const <ListLiteralUse>[],
+ this.mapLiterals: const <MapLiteralUse>[],
+ this.staticUses: const <StaticUse>[],
+ this.typeUses: const <TypeUse>[]})
: this._features = features;
- Iterable<Feature> get features => _features.iterable(Feature.values);
+ Iterable<Feature> get features {
+ return _features != null
+ ? _features.iterable(Feature.values)
+ : const <Feature>[];
+ }
}
class ImpactDeserializer {
/// Deserializes a [WorldImpact] from [objectDecoder].
- static ResolutionImpact deserializeImpact(ObjectDecoder objectDecoder) {
+ static ResolutionImpact deserializeImpact(
+ Element element, ObjectDecoder objectDecoder) {
ListDecoder staticUseDecoder = objectDecoder.getList(Key.STATIC_USES);
List<StaticUse> staticUses = <StaticUse>[];
for (int index = 0; index < staticUseDecoder.length; index++) {
ObjectDecoder object = staticUseDecoder.getObject(index);
StaticUseKind kind = object.getEnum(Key.KIND, StaticUseKind.values);
- Element element = object.getElement(Key.ELEMENT);
- staticUses.add(new StaticUse.internal(element, kind));
+ Element usedElement =
+ deserializeElementReference(element, Key.ELEMENT, Key.NAME, object);
+ staticUses.add(new StaticUse.internal(usedElement, kind));
}
ListDecoder dynamicUseDecoder = objectDecoder.getList(Key.DYNAMIC_USES);

Powered by Google App Engine
This is Rietveld 408576698