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

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

Issue 1929963005: Serialize default constructors separately. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/serialization/keys.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/serialization/element_serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/element_serialization.dart b/pkg/compiler/lib/src/serialization/element_serialization.dart
index 5c8c0d68fc326fb5a79b9a41f29c6d81a8566d9e..ebb179adcb081b1d7a06108bc901cf33b75d6d98 100644
--- a/pkg/compiler/lib/src/serialization/element_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/element_serialization.dart
@@ -23,6 +23,7 @@ enum SerializedElementKind {
ENUM,
NAMED_MIXIN_APPLICATION,
GENERATIVE_CONSTRUCTOR,
+ DEFAULT_CONSTRUCTOR,
FACTORY_CONSTRUCTOR,
REDIRECTING_FACTORY_CONSTRUCTOR,
FORWARDING_CONSTRUCTOR,
@@ -342,8 +343,11 @@ class ConstructorSerializer implements ElementSerializer {
SerializedElementKind getSerializedKind(Element element) {
if (element.isGenerativeConstructor) {
- if (element.enclosingClass.isNamedMixinApplication) {
+ ConstructorElement constructor = element;
+ if (constructor.enclosingClass.isNamedMixinApplication) {
return SerializedElementKind.FORWARDING_CONSTRUCTOR;
+ } else if (constructor.definingConstructor != null) {
+ return SerializedElementKind.DEFAULT_CONSTRUCTOR;
} else {
return SerializedElementKind.GENERATIVE_CONSTRUCTOR;
}
@@ -376,16 +380,6 @@ class ConstructorSerializer implements ElementSerializer {
const ConstantConstructorSerializer()
.visit(constantConstructor, constantEncoder);
}
- if (element.definingConstructor != null) {
- assert(invariant(
- element,
- element.definingConstructor.enclosingClass ==
- element.enclosingClass.superclass,
- message: "Unexpected defining constructor: "
- "${element.definingConstructor}"));
- encoder.setString(
- Key.DEFINING_CONSTRUCTOR, element.definingConstructor.name);
- }
if (kind == SerializedElementKind.GENERATIVE_CONSTRUCTOR) {
encoder.setBool(Key.IS_REDIRECTING, element.isRedirectingGenerative);
}
@@ -689,6 +683,8 @@ class ElementDeserializer {
return new InstanceFieldElementZ(decoder);
case SerializedElementKind.GENERATIVE_CONSTRUCTOR:
return new GenerativeConstructorElementZ(decoder);
+ case SerializedElementKind.DEFAULT_CONSTRUCTOR:
+ return new DefaultConstructorElementZ(decoder);
case SerializedElementKind.FACTORY_CONSTRUCTOR:
return new FactoryConstructorElementZ(decoder);
case SerializedElementKind.REDIRECTING_FACTORY_CONSTRUCTOR:
« no previous file with comments | « no previous file | pkg/compiler/lib/src/serialization/keys.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698