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

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

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/serialization/modelz.dart
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart
index 13d4ba6707fe13404a90a67e971c40c3e2586f1f..d96bcf9c96e470b2e5196595d4251a720e35b8b5 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -276,7 +276,8 @@ abstract class AnalyzableElementMixin implements AnalyzableElement, ElementZ {
TreeElements get treeElements => _unsupported('treeElements');
}
-abstract class AstElementMixinZ implements AstElement, ElementZ {
+abstract class AstElementMixinZ<N extends Node>
+ implements AstElement, ElementZ {
ResolvedAst _resolvedAst;
// TODO(johnniwinther): This is needed for the token invariant assertion. Find
@@ -288,7 +289,7 @@ abstract class AstElementMixinZ implements AstElement, ElementZ {
bool get hasResolvedAst => _resolvedAst != null;
@override
- get node => _unsupported('node');
+ N get node => _unsupported('node');
@override
ResolvedAst get resolvedAst {
@@ -399,6 +400,7 @@ class AbstractFieldElementZ extends ElementZ
bool get isTopLevel => _canonicalElement.isTopLevel;
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class LibraryElementZ extends DeserializedElementZ
with AnalyzableElementMixin, ContainerMixin, LibraryElementCommon
implements LibraryElement {
@@ -760,11 +762,12 @@ abstract class StaticMemberMixin implements DeserializedElementZ {
bool get isClassMember => true;
}
-abstract class TypedElementMixin implements DeserializedElementZ, TypedElement {
- ResolutionDartType _type;
+abstract class TypedElementMixin<T extends ResolutionDartType>
+ implements DeserializedElementZ, TypedElement {
+ T _type;
@override
- ResolutionDartType get type {
+ T get type {
if (_type == null) {
_type = _decoder.getType(Key.TYPE);
}
@@ -772,7 +775,7 @@ abstract class TypedElementMixin implements DeserializedElementZ, TypedElement {
}
@override
- ResolutionDartType computeType(Resolution resolution) => type;
+ T computeType(Resolution resolution) => type;
}
abstract class ParametersMixin
@@ -921,6 +924,7 @@ abstract class ClassElementMixin
}
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class ClassElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
@@ -929,7 +933,7 @@ class ClassElementZ extends DeserializedElementZ
class_members.ClassMemberMixin,
ContainerMixin,
LibraryMemberMixin,
- TypeDeclarationMixin<ResolutionInterfaceType>,
+ TypeDeclarationMixin,
ClassElementMixin
implements ClassElement {
bool _isObject;
@@ -1020,6 +1024,10 @@ class ClassElementZ extends DeserializedElementZ
// TODO(johnniwinther): Why can't this always be computed in ensureResolved?
return _callType;
}
+
+ ResolutionInterfaceType get thisType => super.thisType;
+
+ ResolutionInterfaceType get rawType => super.rawType;
}
abstract class MixinApplicationElementMixin
@@ -1051,7 +1059,8 @@ class UnnamedMixinApplicationElementZ extends ElementZ
ClassElementCommon,
ClassElementMixin,
class_members.ClassMemberMixin,
- TypeDeclarationMixin<ResolutionInterfaceType>,
+ // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_MIXIN
+ TypeDeclarationMixin,
AnalyzableElementMixin,
AstElementMixinZ,
MixinApplicationElementCommon,
@@ -1202,6 +1211,7 @@ class UnnamedMixinApplicationElementZ extends ElementZ
SourceSpan get sourcePosition => subclass.sourcePosition;
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
List<FieldElement> _enumValues;
@@ -1211,7 +1221,7 @@ class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
bool get isEnumClass => true;
@override
- List<FieldElement> get enumValues {
+ List<EnumConstantElement> get enumValues {
if (_enumValues == null) {
_enumValues = _decoder.getElements(Key.FIELDS);
}
@@ -1219,14 +1229,15 @@ class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
}
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
abstract class ConstructorElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<FunctionExpression>,
ClassMemberMixin,
FunctionTypedElementMixin,
ParametersMixin,
- TypedElementMixin,
+ TypedElementMixin<ResolutionFunctionType>,
MemberElementMixin,
ConstructorElementCommon
implements
@@ -1306,7 +1317,7 @@ abstract class ConstructorElementZ extends DeserializedElementZ
PrefixElement get redirectionDeferredPrefix => null;
@override
- ResolutionInterfaceType computeEffectiveTargetType(
+ ResolutionDartType computeEffectiveTargetType(
ResolutionInterfaceType newType) =>
newType;
}
@@ -1416,10 +1427,11 @@ class RedirectingFactoryConstructorElementZ extends ConstructorElementZ {
}
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class ForwardingConstructorElementZ extends ElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ
+ AstElementMixinZ<FunctionExpression>
implements
ConstructorElement,
// TODO(johnniwinther): Sort out whether a constructor is a method.
@@ -1441,7 +1453,7 @@ class ForwardingConstructorElementZ extends ElementZ
AsyncMarker get asyncMarker => AsyncMarker.SYNC;
@override
- ResolutionInterfaceType computeEffectiveTargetType(
+ ResolutionDartType computeEffectiveTargetType(
ResolutionInterfaceType newType) {
return enclosingClass.thisType.substByContext(newType);
}
@@ -1583,7 +1595,7 @@ abstract class MemberElementMixin
abstract class FieldElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<VariableDefinitions>,
TypedElementMixin,
MemberElementMixin
implements FieldElement {
@@ -1638,6 +1650,7 @@ class StaticFieldElementZ extends FieldElementZ
StaticFieldElementZ(ObjectDecoder decoder) : super(decoder);
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class EnumConstantElementZ extends StaticFieldElementZ
implements EnumConstantElement {
EnumConstantElementZ(ObjectDecoder decoder) : super(decoder);
@@ -1650,13 +1663,14 @@ class InstanceFieldElementZ extends FieldElementZ
InstanceFieldElementZ(ObjectDecoder decoder) : super(decoder);
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
abstract class FunctionElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<FunctionExpression>,
ParametersMixin,
FunctionTypedElementMixin,
- TypedElementMixin,
+ TypedElementMixin<ResolutionFunctionType>,
MemberElementMixin
implements MethodElement {
FunctionElementZ(ObjectDecoder decoder) : super(decoder);
@@ -1704,7 +1718,7 @@ abstract class LocalExecutableMixin
Element get enclosingElement => executableContext;
@override
- Element get enclosingClass => memberContext.enclosingClass;
+ ClassElementZ get enclosingClass => memberContext.enclosingClass;
@override
ExecutableElement get executableContext {
@@ -1735,13 +1749,14 @@ abstract class LocalExecutableMixin
TreeElements get treeElements => memberContext.treeElements;
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
class LocalFunctionElementZ extends DeserializedElementZ
with
LocalExecutableMixin,
- AstElementMixinZ,
+ AstElementMixinZ<FunctionExpression>,
ParametersMixin,
FunctionTypedElementMixin,
- TypedElementMixin
+ TypedElementMixin<ResolutionFunctionType>
implements LocalFunctionElement {
LocalFunctionElementZ(ObjectDecoder decoder) : super(decoder);
@@ -1759,13 +1774,14 @@ class LocalFunctionElementZ extends DeserializedElementZ
}
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
abstract class GetterElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<FunctionExpression>,
FunctionTypedElementMixin,
ParametersMixin,
- TypedElementMixin,
+ TypedElementMixin<ResolutionFunctionType>,
MemberElementMixin
implements GetterElement {
AbstractFieldElement abstractField;
@@ -1804,13 +1820,14 @@ class InstanceGetterElementZ extends GetterElementZ
InstanceGetterElementZ(ObjectDecoder decoder) : super(decoder);
}
+// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
abstract class SetterElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<FunctionExpression>,
FunctionTypedElementMixin,
ParametersMixin,
- TypedElementMixin,
+ TypedElementMixin<ResolutionFunctionType>,
MemberElementMixin
implements SetterElement {
AbstractFieldElement abstractField;
@@ -1847,11 +1864,11 @@ class InstanceSetterElementZ extends SetterElementZ
InstanceSetterElementZ(ObjectDecoder decoder) : super(decoder);
}
-abstract class TypeDeclarationMixin<T extends GenericType>
+abstract class TypeDeclarationMixin
implements ElementZ, TypeDeclarationElement {
List<ResolutionDartType> _typeVariables;
- T _rawType;
- T _thisType;
+ GenericType _rawType;
+ GenericType _thisType;
Name _memberName;
Name get memberName {
@@ -1872,7 +1889,7 @@ abstract class TypeDeclarationMixin<T extends GenericType>
}
}
- T _createType(List<ResolutionDartType> typeArguments);
+ GenericType _createType(List<ResolutionDartType> typeArguments);
@override
List<ResolutionDartType> get typeVariables {
@@ -1881,19 +1898,19 @@ abstract class TypeDeclarationMixin<T extends GenericType>
}
@override
- T get rawType {
+ GenericType get rawType {
_ensureTypes();
return _rawType;
}
@override
- T get thisType {
+ GenericType get thisType {
_ensureTypes();
return _thisType;
}
@override
- T computeType(Resolution resolution) => thisType;
+ GenericType computeType(Resolution resolution) => thisType;
@override
bool get isResolved => true;
@@ -1902,10 +1919,10 @@ abstract class TypeDeclarationMixin<T extends GenericType>
class TypedefElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<Node>,
LibraryMemberMixin,
ParametersMixin,
- TypeDeclarationMixin<ResolutionTypedefType>
+ TypeDeclarationMixin
implements TypedefElement {
ResolutionDartType _alias;
@@ -1941,10 +1958,17 @@ class TypedefElementZ extends DeserializedElementZ
@override
void checkCyclicReference(Resolution resolution) {}
+
+ ResolutionTypedefType get thisType => super.thisType;
+
+ ResolutionTypedefType get rawType => super.rawType;
}
class TypeVariableElementZ extends DeserializedElementZ
- with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
+ with
+ AnalyzableElementMixin,
+ AstElementMixinZ<Node>,
+ TypedElementMixin<ResolutionTypeVariableType>
implements TypeVariableElement {
GenericElement _typeDeclaration;
ResolutionTypeVariableType _type;
@@ -1977,7 +2001,7 @@ class TypeVariableElementZ extends DeserializedElementZ
Element get enclosingElement => typeDeclaration;
@override
- Element get enclosingClass => typeDeclaration;
+ ClassElementZ get enclosingClass => typeDeclaration;
@override
int get index => _decoder.getInt(Key.INDEX);
@@ -2002,7 +2026,7 @@ class TypeVariableElementZ extends DeserializedElementZ
}
class SyntheticTypeVariableElementZ extends ElementZ
- with AnalyzableElementMixin, AstElementMixinZ
+ with AnalyzableElementMixin, AstElementMixinZ<Node>
implements TypeVariableElement {
final TypeDeclarationElement typeDeclaration;
final int index;
@@ -2047,7 +2071,7 @@ class SyntheticTypeVariableElementZ extends ElementZ
Element get enclosingElement => typeDeclaration;
@override
- Element get enclosingClass => typeDeclaration;
+ ClassElementZ get enclosingClass => typeDeclaration;
ResolutionDartType get bound {
assert(_bound != null,
@@ -2066,7 +2090,10 @@ class SyntheticTypeVariableElementZ extends ElementZ
}
abstract class ParameterElementZ extends DeserializedElementZ
- with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
+ with
+ AnalyzableElementMixin,
+ AstElementMixinZ<VariableDefinitions>,
+ TypedElementMixin
implements ParameterElement {
FunctionElement _functionDeclaration;
ConstantExpression _constant;
@@ -2122,7 +2149,7 @@ abstract class ParameterElementZ extends DeserializedElementZ
Expression initializer;
@override
- Node node;
+ VariableDefinitions node;
@override
bool get isNamed => _decoder.getBool(Key.IS_NAMED);
@@ -2183,12 +2210,14 @@ class InitializingFormalElementZ extends LocalParameterElementZ
@override
bool get isLocal => true;
+
+ ConstructorElementZ get functionDeclaration => super.functionDeclaration;
}
class LocalVariableElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixinZ,
+ AstElementMixinZ<VariableDefinitions>,
LocalExecutableMixin,
TypedElementMixin
implements LocalVariableElement {
« no previous file with comments | « pkg/compiler/lib/src/serialization/json_serializer.dart ('k') | pkg/compiler/lib/src/serialization/system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698