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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Implementation of the element model used for deserialiation. 5 /// Implementation of the element model used for deserialiation.
6 /// 6 ///
7 /// These classes are created by [ElementDeserializer] triggered by the 7 /// These classes are created by [ElementDeserializer] triggered by the
8 /// [Deserializer]. 8 /// [Deserializer].
9 9
10 library dart2js.serialization.modelz; 10 library dart2js.serialization.modelz;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 abstract class AnalyzableElementMixin implements AnalyzableElement, ElementZ { 271 abstract class AnalyzableElementMixin implements AnalyzableElement, ElementZ {
272 @override 272 @override
273 bool get hasTreeElements => _unsupported('hasTreeElements'); 273 bool get hasTreeElements => _unsupported('hasTreeElements');
274 274
275 @override 275 @override
276 TreeElements get treeElements => _unsupported('treeElements'); 276 TreeElements get treeElements => _unsupported('treeElements');
277 } 277 }
278 278
279 abstract class AstElementMixinZ implements AstElement, ElementZ { 279 abstract class AstElementMixinZ<N extends Node>
280 implements AstElement, ElementZ {
280 ResolvedAst _resolvedAst; 281 ResolvedAst _resolvedAst;
281 282
282 // TODO(johnniwinther): This is needed for the token invariant assertion. Find 283 // TODO(johnniwinther): This is needed for the token invariant assertion. Find
283 // another way to bypass the test for modelz. 284 // another way to bypass the test for modelz.
284 @override 285 @override
285 bool get hasNode => false; 286 bool get hasNode => false;
286 287
287 @override 288 @override
288 bool get hasResolvedAst => _resolvedAst != null; 289 bool get hasResolvedAst => _resolvedAst != null;
289 290
290 @override 291 @override
291 get node => _unsupported('node'); 292 N get node => _unsupported('node');
292 293
293 @override 294 @override
294 ResolvedAst get resolvedAst { 295 ResolvedAst get resolvedAst {
295 assert(_resolvedAst != null, 296 assert(_resolvedAst != null,
296 failedAt(this, "ResolvedAst has not been set for $this.")); 297 failedAt(this, "ResolvedAst has not been set for $this."));
297 return _resolvedAst; 298 return _resolvedAst;
298 } 299 }
299 300
300 void set resolvedAst(ResolvedAst value) { 301 void set resolvedAst(ResolvedAst value) {
301 assert(_resolvedAst == null, 302 assert(_resolvedAst == null,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 @override 393 @override
393 bool get isInstanceMember => _canonicalElement.isInstanceMember; 394 bool get isInstanceMember => _canonicalElement.isInstanceMember;
394 395
395 @override 396 @override
396 bool get isStatic => _canonicalElement.isStatic; 397 bool get isStatic => _canonicalElement.isStatic;
397 398
398 @override 399 @override
399 bool get isTopLevel => _canonicalElement.isTopLevel; 400 bool get isTopLevel => _canonicalElement.isTopLevel;
400 } 401 }
401 402
403 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
402 class LibraryElementZ extends DeserializedElementZ 404 class LibraryElementZ extends DeserializedElementZ
403 with AnalyzableElementMixin, ContainerMixin, LibraryElementCommon 405 with AnalyzableElementMixin, ContainerMixin, LibraryElementCommon
404 implements LibraryElement { 406 implements LibraryElement {
405 Uri _canonicalUri; 407 Uri _canonicalUri;
406 CompilationUnitElement _entryCompilationUnit; 408 CompilationUnitElement _entryCompilationUnit;
407 Link<CompilationUnitElement> _compilationUnits; 409 Link<CompilationUnitElement> _compilationUnits;
408 List<ImportElement> _imports; 410 List<ImportElement> _imports;
409 List<ExportElement> _exports; 411 List<ExportElement> _exports;
410 ListedContainer _exportsMap; 412 ListedContainer _exportsMap;
411 ListedContainer _importsMap; 413 ListedContainer _importsMap;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 @override 755 @override
754 bool get isTopLevel => false; 756 bool get isTopLevel => false;
755 757
756 @override 758 @override
757 bool get isStatic => true; 759 bool get isStatic => true;
758 760
759 @override 761 @override
760 bool get isClassMember => true; 762 bool get isClassMember => true;
761 } 763 }
762 764
763 abstract class TypedElementMixin implements DeserializedElementZ, TypedElement { 765 abstract class TypedElementMixin<T extends ResolutionDartType>
764 ResolutionDartType _type; 766 implements DeserializedElementZ, TypedElement {
767 T _type;
765 768
766 @override 769 @override
767 ResolutionDartType get type { 770 T get type {
768 if (_type == null) { 771 if (_type == null) {
769 _type = _decoder.getType(Key.TYPE); 772 _type = _decoder.getType(Key.TYPE);
770 } 773 }
771 return _type; 774 return _type;
772 } 775 }
773 776
774 @override 777 @override
775 ResolutionDartType computeType(Resolution resolution) => type; 778 T computeType(Resolution resolution) => type;
776 } 779 }
777 780
778 abstract class ParametersMixin 781 abstract class ParametersMixin
779 implements DeserializedElementZ, FunctionTypedElement { 782 implements DeserializedElementZ, FunctionTypedElement {
780 FunctionSignature _functionSignature; 783 FunctionSignature _functionSignature;
781 List<ParameterElement> _parameters; 784 List<ParameterElement> _parameters;
782 785
783 bool get hasFunctionSignature => true; 786 bool get hasFunctionSignature => true;
784 787
785 @override 788 @override
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 _isResolved = true; 917 _isResolved = true;
915 // TODO(johnniwinther): Avoid eager computation of all members. `call` is 918 // TODO(johnniwinther): Avoid eager computation of all members. `call` is
916 // always needed, but the remaining should be computed on-demand or on 919 // always needed, but the remaining should be computed on-demand or on
917 // type instantiation. 920 // type instantiation.
918 class_members.MembersCreator.computeAllClassMembers(resolution, this); 921 class_members.MembersCreator.computeAllClassMembers(resolution, this);
919 resolution.registerClass(this); 922 resolution.registerClass(this);
920 } 923 }
921 } 924 }
922 } 925 }
923 926
927 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
924 class ClassElementZ extends DeserializedElementZ 928 class ClassElementZ extends DeserializedElementZ
925 with 929 with
926 AnalyzableElementMixin, 930 AnalyzableElementMixin,
927 AstElementMixinZ, 931 AstElementMixinZ,
928 ClassElementCommon, 932 ClassElementCommon,
929 class_members.ClassMemberMixin, 933 class_members.ClassMemberMixin,
930 ContainerMixin, 934 ContainerMixin,
931 LibraryMemberMixin, 935 LibraryMemberMixin,
932 TypeDeclarationMixin<ResolutionInterfaceType>, 936 TypeDeclarationMixin,
933 ClassElementMixin 937 ClassElementMixin
934 implements ClassElement { 938 implements ClassElement {
935 bool _isObject; 939 bool _isObject;
936 ResolutionInterfaceType _supertype; 940 ResolutionInterfaceType _supertype;
937 OrderedTypeSet _allSupertypesAndSelf; 941 OrderedTypeSet _allSupertypesAndSelf;
938 Link<ResolutionDartType> _interfaces; 942 Link<ResolutionDartType> _interfaces;
939 ResolutionFunctionType _callType; 943 ResolutionFunctionType _callType;
940 944
941 ClassElementZ(ObjectDecoder decoder) : super(decoder); 945 ClassElementZ(ObjectDecoder decoder) : super(decoder);
942 946
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1017
1014 @override 1018 @override
1015 bool get isUnnamedMixinApplication => false; 1019 bool get isUnnamedMixinApplication => false;
1016 1020
1017 @override 1021 @override
1018 ResolutionFunctionType get callType { 1022 ResolutionFunctionType get callType {
1019 _ensureSuperHierarchy(); 1023 _ensureSuperHierarchy();
1020 // TODO(johnniwinther): Why can't this always be computed in ensureResolved? 1024 // TODO(johnniwinther): Why can't this always be computed in ensureResolved?
1021 return _callType; 1025 return _callType;
1022 } 1026 }
1027
1028 ResolutionInterfaceType get thisType => super.thisType;
1029
1030 ResolutionInterfaceType get rawType => super.rawType;
1023 } 1031 }
1024 1032
1025 abstract class MixinApplicationElementMixin 1033 abstract class MixinApplicationElementMixin
1026 implements ElementZ, MixinApplicationElement { 1034 implements ElementZ, MixinApplicationElement {
1027 @override 1035 @override
1028 bool get isMixinApplication => true; 1036 bool get isMixinApplication => true;
1029 1037
1030 @override 1038 @override
1031 ClassElement get mixin => mixinType.element; 1039 ClassElement get mixin => mixinType.element;
1032 } 1040 }
(...skipping 11 matching lines...) Expand all
1044 1052
1045 @override 1053 @override
1046 ClassElement get subclass => null; 1054 ClassElement get subclass => null;
1047 } 1055 }
1048 1056
1049 class UnnamedMixinApplicationElementZ extends ElementZ 1057 class UnnamedMixinApplicationElementZ extends ElementZ
1050 with 1058 with
1051 ClassElementCommon, 1059 ClassElementCommon,
1052 ClassElementMixin, 1060 ClassElementMixin,
1053 class_members.ClassMemberMixin, 1061 class_members.ClassMemberMixin,
1054 TypeDeclarationMixin<ResolutionInterfaceType>, 1062 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_MIXIN
1063 TypeDeclarationMixin,
1055 AnalyzableElementMixin, 1064 AnalyzableElementMixin,
1056 AstElementMixinZ, 1065 AstElementMixinZ,
1057 MixinApplicationElementCommon, 1066 MixinApplicationElementCommon,
1058 MixinApplicationElementMixin { 1067 MixinApplicationElementMixin {
1059 final String name; 1068 final String name;
1060 final ClassElement subclass; 1069 final ClassElement subclass;
1061 final ResolutionInterfaceType _supertypeBase; 1070 final ResolutionInterfaceType _supertypeBase;
1062 final ResolutionInterfaceType _mixinBase; 1071 final ResolutionInterfaceType _mixinBase;
1063 ResolutionInterfaceType _supertype; 1072 ResolutionInterfaceType _supertype;
1064 Link<ResolutionDartType> _interfaces; 1073 Link<ResolutionDartType> _interfaces;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 @override 1204 @override
1196 ResolutionInterfaceType get mixinType => interfaces.head; 1205 ResolutionInterfaceType get mixinType => interfaces.head;
1197 1206
1198 @override 1207 @override
1199 int get sourceOffset => subclass.sourceOffset; 1208 int get sourceOffset => subclass.sourceOffset;
1200 1209
1201 @override 1210 @override
1202 SourceSpan get sourcePosition => subclass.sourcePosition; 1211 SourceSpan get sourcePosition => subclass.sourcePosition;
1203 } 1212 }
1204 1213
1214 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1205 class EnumClassElementZ extends ClassElementZ implements EnumClassElement { 1215 class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
1206 List<FieldElement> _enumValues; 1216 List<FieldElement> _enumValues;
1207 1217
1208 EnumClassElementZ(ObjectDecoder decoder) : super(decoder); 1218 EnumClassElementZ(ObjectDecoder decoder) : super(decoder);
1209 1219
1210 @override 1220 @override
1211 bool get isEnumClass => true; 1221 bool get isEnumClass => true;
1212 1222
1213 @override 1223 @override
1214 List<FieldElement> get enumValues { 1224 List<EnumConstantElement> get enumValues {
1215 if (_enumValues == null) { 1225 if (_enumValues == null) {
1216 _enumValues = _decoder.getElements(Key.FIELDS); 1226 _enumValues = _decoder.getElements(Key.FIELDS);
1217 } 1227 }
1218 return _enumValues; 1228 return _enumValues;
1219 } 1229 }
1220 } 1230 }
1221 1231
1232 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1222 abstract class ConstructorElementZ extends DeserializedElementZ 1233 abstract class ConstructorElementZ extends DeserializedElementZ
1223 with 1234 with
1224 AnalyzableElementMixin, 1235 AnalyzableElementMixin,
1225 AstElementMixinZ, 1236 AstElementMixinZ<FunctionExpression>,
1226 ClassMemberMixin, 1237 ClassMemberMixin,
1227 FunctionTypedElementMixin, 1238 FunctionTypedElementMixin,
1228 ParametersMixin, 1239 ParametersMixin,
1229 TypedElementMixin, 1240 TypedElementMixin<ResolutionFunctionType>,
1230 MemberElementMixin, 1241 MemberElementMixin,
1231 ConstructorElementCommon 1242 ConstructorElementCommon
1232 implements 1243 implements
1233 ConstructorElement, 1244 ConstructorElement,
1234 // TODO(johnniwinther): Sort out whether a constructor is a method. 1245 // TODO(johnniwinther): Sort out whether a constructor is a method.
1235 MethodElement { 1246 MethodElement {
1236 ConstantConstructor _constantConstructor; 1247 ConstantConstructor _constantConstructor;
1237 ConstructorElement _effectiveTarget; 1248 ConstructorElement _effectiveTarget;
1238 1249
1239 ConstructorElementZ(ObjectDecoder decoder) : super(decoder); 1250 ConstructorElementZ(ObjectDecoder decoder) : super(decoder);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 @override 1310 @override
1300 bool get isRedirectingFactory => false; 1311 bool get isRedirectingFactory => false;
1301 1312
1302 @override 1313 @override
1303 bool get isRedirectingGenerative => false; 1314 bool get isRedirectingGenerative => false;
1304 1315
1305 @override 1316 @override
1306 PrefixElement get redirectionDeferredPrefix => null; 1317 PrefixElement get redirectionDeferredPrefix => null;
1307 1318
1308 @override 1319 @override
1309 ResolutionInterfaceType computeEffectiveTargetType( 1320 ResolutionDartType computeEffectiveTargetType(
1310 ResolutionInterfaceType newType) => 1321 ResolutionInterfaceType newType) =>
1311 newType; 1322 newType;
1312 } 1323 }
1313 1324
1314 class GenerativeConstructorElementZ extends ConstructorElementZ { 1325 class GenerativeConstructorElementZ extends ConstructorElementZ {
1315 GenerativeConstructorElementZ(ObjectDecoder decoder) : super(decoder); 1326 GenerativeConstructorElementZ(ObjectDecoder decoder) : super(decoder);
1316 1327
1317 @override 1328 @override
1318 ElementKind get kind => ElementKind.GENERATIVE_CONSTRUCTOR; 1329 ElementKind get kind => ElementKind.GENERATIVE_CONSTRUCTOR;
1319 1330
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 return _immediateRedirectionTarget; 1420 return _immediateRedirectionTarget;
1410 } 1421 }
1411 1422
1412 @override 1423 @override
1413 PrefixElement get redirectionDeferredPrefix { 1424 PrefixElement get redirectionDeferredPrefix {
1414 _ensureRedirection(); 1425 _ensureRedirection();
1415 return _redirectionDeferredPrefix; 1426 return _redirectionDeferredPrefix;
1416 } 1427 }
1417 } 1428 }
1418 1429
1430 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1419 class ForwardingConstructorElementZ extends ElementZ 1431 class ForwardingConstructorElementZ extends ElementZ
1420 with 1432 with
1421 AnalyzableElementMixin, 1433 AnalyzableElementMixin,
1422 AstElementMixinZ 1434 AstElementMixinZ<FunctionExpression>
1423 implements 1435 implements
1424 ConstructorElement, 1436 ConstructorElement,
1425 // TODO(johnniwinther): Sort out whether a constructor is a method. 1437 // TODO(johnniwinther): Sort out whether a constructor is a method.
1426 MethodElement { 1438 MethodElement {
1427 final MixinApplicationElement enclosingClass; 1439 final MixinApplicationElement enclosingClass;
1428 final ConstructorElement definingConstructor; 1440 final ConstructorElement definingConstructor;
1429 1441
1430 ForwardingConstructorElementZ(this.enclosingClass, this.definingConstructor); 1442 ForwardingConstructorElementZ(this.enclosingClass, this.definingConstructor);
1431 1443
1432 @override 1444 @override
1433 CompilationUnitElement get compilationUnit => enclosingClass.compilationUnit; 1445 CompilationUnitElement get compilationUnit => enclosingClass.compilationUnit;
1434 1446
1435 @override 1447 @override
1436 accept(ElementVisitor visitor, arg) { 1448 accept(ElementVisitor visitor, arg) {
1437 return visitor.visitConstructorElement(this, arg); 1449 return visitor.visitConstructorElement(this, arg);
1438 } 1450 }
1439 1451
1440 @override 1452 @override
1441 AsyncMarker get asyncMarker => AsyncMarker.SYNC; 1453 AsyncMarker get asyncMarker => AsyncMarker.SYNC;
1442 1454
1443 @override 1455 @override
1444 ResolutionInterfaceType computeEffectiveTargetType( 1456 ResolutionDartType computeEffectiveTargetType(
1445 ResolutionInterfaceType newType) { 1457 ResolutionInterfaceType newType) {
1446 return enclosingClass.thisType.substByContext(newType); 1458 return enclosingClass.thisType.substByContext(newType);
1447 } 1459 }
1448 1460
1449 @override 1461 @override
1450 ResolutionDartType computeType(Resolution resolution) => type; 1462 ResolutionDartType computeType(Resolution resolution) => type;
1451 1463
1452 @override 1464 @override
1453 bool get isConst => false; 1465 bool get isConst => false;
1454 1466
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 @override 1588 @override
1577 Name get memberName => new Name(name, library); 1589 Name get memberName => new Name(name, library);
1578 1590
1579 @override 1591 @override
1580 bool get isInjected => _decoder.getBool(Key.IS_INJECTED); 1592 bool get isInjected => _decoder.getBool(Key.IS_INJECTED);
1581 } 1593 }
1582 1594
1583 abstract class FieldElementZ extends DeserializedElementZ 1595 abstract class FieldElementZ extends DeserializedElementZ
1584 with 1596 with
1585 AnalyzableElementMixin, 1597 AnalyzableElementMixin,
1586 AstElementMixinZ, 1598 AstElementMixinZ<VariableDefinitions>,
1587 TypedElementMixin, 1599 TypedElementMixin,
1588 MemberElementMixin 1600 MemberElementMixin
1589 implements FieldElement { 1601 implements FieldElement {
1590 bool _isConst; 1602 bool _isConst;
1591 ConstantExpression _constant; 1603 ConstantExpression _constant;
1592 1604
1593 FieldElementZ(ObjectDecoder decoder) : super(decoder); 1605 FieldElementZ(ObjectDecoder decoder) : super(decoder);
1594 1606
1595 @override 1607 @override
1596 ElementKind get kind => ElementKind.FIELD; 1608 ElementKind get kind => ElementKind.FIELD;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1643
1632 class TopLevelFieldElementZ extends FieldElementZ with LibraryMemberMixin { 1644 class TopLevelFieldElementZ extends FieldElementZ with LibraryMemberMixin {
1633 TopLevelFieldElementZ(ObjectDecoder decoder) : super(decoder); 1645 TopLevelFieldElementZ(ObjectDecoder decoder) : super(decoder);
1634 } 1646 }
1635 1647
1636 class StaticFieldElementZ extends FieldElementZ 1648 class StaticFieldElementZ extends FieldElementZ
1637 with ClassMemberMixin, StaticMemberMixin { 1649 with ClassMemberMixin, StaticMemberMixin {
1638 StaticFieldElementZ(ObjectDecoder decoder) : super(decoder); 1650 StaticFieldElementZ(ObjectDecoder decoder) : super(decoder);
1639 } 1651 }
1640 1652
1653 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1641 class EnumConstantElementZ extends StaticFieldElementZ 1654 class EnumConstantElementZ extends StaticFieldElementZ
1642 implements EnumConstantElement { 1655 implements EnumConstantElement {
1643 EnumConstantElementZ(ObjectDecoder decoder) : super(decoder); 1656 EnumConstantElementZ(ObjectDecoder decoder) : super(decoder);
1644 1657
1645 int get index => _decoder.getInt(Key.INDEX); 1658 int get index => _decoder.getInt(Key.INDEX);
1646 } 1659 }
1647 1660
1648 class InstanceFieldElementZ extends FieldElementZ 1661 class InstanceFieldElementZ extends FieldElementZ
1649 with ClassMemberMixin, InstanceMemberMixin { 1662 with ClassMemberMixin, InstanceMemberMixin {
1650 InstanceFieldElementZ(ObjectDecoder decoder) : super(decoder); 1663 InstanceFieldElementZ(ObjectDecoder decoder) : super(decoder);
1651 } 1664 }
1652 1665
1666 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1653 abstract class FunctionElementZ extends DeserializedElementZ 1667 abstract class FunctionElementZ extends DeserializedElementZ
1654 with 1668 with
1655 AnalyzableElementMixin, 1669 AnalyzableElementMixin,
1656 AstElementMixinZ, 1670 AstElementMixinZ<FunctionExpression>,
1657 ParametersMixin, 1671 ParametersMixin,
1658 FunctionTypedElementMixin, 1672 FunctionTypedElementMixin,
1659 TypedElementMixin, 1673 TypedElementMixin<ResolutionFunctionType>,
1660 MemberElementMixin 1674 MemberElementMixin
1661 implements MethodElement { 1675 implements MethodElement {
1662 FunctionElementZ(ObjectDecoder decoder) : super(decoder); 1676 FunctionElementZ(ObjectDecoder decoder) : super(decoder);
1663 1677
1664 @override 1678 @override
1665 ElementKind get kind => ElementKind.FUNCTION; 1679 ElementKind get kind => ElementKind.FUNCTION;
1666 1680
1667 @override 1681 @override
1668 accept(ElementVisitor visitor, arg) { 1682 accept(ElementVisitor visitor, arg) {
1669 return visitor.visitMethodElement(this, arg); 1683 return visitor.visitMethodElement(this, arg);
(...skipping 27 matching lines...) Expand all
1697 } 1711 }
1698 1712
1699 abstract class LocalExecutableMixin 1713 abstract class LocalExecutableMixin
1700 implements DeserializedElementZ, ExecutableElement, LocalElement { 1714 implements DeserializedElementZ, ExecutableElement, LocalElement {
1701 ExecutableElement _executableContext; 1715 ExecutableElement _executableContext;
1702 1716
1703 @override 1717 @override
1704 Element get enclosingElement => executableContext; 1718 Element get enclosingElement => executableContext;
1705 1719
1706 @override 1720 @override
1707 Element get enclosingClass => memberContext.enclosingClass; 1721 ClassElementZ get enclosingClass => memberContext.enclosingClass;
1708 1722
1709 @override 1723 @override
1710 ExecutableElement get executableContext { 1724 ExecutableElement get executableContext {
1711 if (_executableContext == null) { 1725 if (_executableContext == null) {
1712 _executableContext = _decoder.getElement(Key.EXECUTABLE_CONTEXT); 1726 _executableContext = _decoder.getElement(Key.EXECUTABLE_CONTEXT);
1713 } 1727 }
1714 return _executableContext; 1728 return _executableContext;
1715 } 1729 }
1716 1730
1717 @override 1731 @override
(...skipping 10 matching lines...) Expand all
1728 return memberContext.compilationUnit; 1742 return memberContext.compilationUnit;
1729 } 1743 }
1730 1744
1731 @override 1745 @override
1732 bool get hasTreeElements => memberContext.hasTreeElements; 1746 bool get hasTreeElements => memberContext.hasTreeElements;
1733 1747
1734 @override 1748 @override
1735 TreeElements get treeElements => memberContext.treeElements; 1749 TreeElements get treeElements => memberContext.treeElements;
1736 } 1750 }
1737 1751
1752 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1738 class LocalFunctionElementZ extends DeserializedElementZ 1753 class LocalFunctionElementZ extends DeserializedElementZ
1739 with 1754 with
1740 LocalExecutableMixin, 1755 LocalExecutableMixin,
1741 AstElementMixinZ, 1756 AstElementMixinZ<FunctionExpression>,
1742 ParametersMixin, 1757 ParametersMixin,
1743 FunctionTypedElementMixin, 1758 FunctionTypedElementMixin,
1744 TypedElementMixin 1759 TypedElementMixin<ResolutionFunctionType>
1745 implements LocalFunctionElement { 1760 implements LocalFunctionElement {
1746 LocalFunctionElementZ(ObjectDecoder decoder) : super(decoder); 1761 LocalFunctionElementZ(ObjectDecoder decoder) : super(decoder);
1747 1762
1748 @override 1763 @override
1749 accept(ElementVisitor visitor, arg) { 1764 accept(ElementVisitor visitor, arg) {
1750 return visitor.visitLocalFunctionElement(this, arg); 1765 return visitor.visitLocalFunctionElement(this, arg);
1751 } 1766 }
1752 1767
1753 @override 1768 @override
1754 ElementKind get kind => ElementKind.FUNCTION; 1769 ElementKind get kind => ElementKind.FUNCTION;
1755 1770
1756 @override 1771 @override
1757 AsyncMarker get asyncMarker { 1772 AsyncMarker get asyncMarker {
1758 return _decoder.getEnum(Key.ASYNC_MARKER, AsyncMarker.values); 1773 return _decoder.getEnum(Key.ASYNC_MARKER, AsyncMarker.values);
1759 } 1774 }
1760 } 1775 }
1761 1776
1777 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1762 abstract class GetterElementZ extends DeserializedElementZ 1778 abstract class GetterElementZ extends DeserializedElementZ
1763 with 1779 with
1764 AnalyzableElementMixin, 1780 AnalyzableElementMixin,
1765 AstElementMixinZ, 1781 AstElementMixinZ<FunctionExpression>,
1766 FunctionTypedElementMixin, 1782 FunctionTypedElementMixin,
1767 ParametersMixin, 1783 ParametersMixin,
1768 TypedElementMixin, 1784 TypedElementMixin<ResolutionFunctionType>,
1769 MemberElementMixin 1785 MemberElementMixin
1770 implements GetterElement { 1786 implements GetterElement {
1771 AbstractFieldElement abstractField; 1787 AbstractFieldElement abstractField;
1772 SetterElement setter; 1788 SetterElement setter;
1773 1789
1774 GetterElementZ(ObjectDecoder decoder) : super(decoder); 1790 GetterElementZ(ObjectDecoder decoder) : super(decoder);
1775 1791
1776 @override 1792 @override
1777 ElementKind get kind => ElementKind.GETTER; 1793 ElementKind get kind => ElementKind.GETTER;
1778 1794
(...skipping 18 matching lines...) Expand all
1797 class StaticGetterElementZ extends GetterElementZ 1813 class StaticGetterElementZ extends GetterElementZ
1798 with ClassMemberMixin, StaticMemberMixin { 1814 with ClassMemberMixin, StaticMemberMixin {
1799 StaticGetterElementZ(ObjectDecoder decoder) : super(decoder); 1815 StaticGetterElementZ(ObjectDecoder decoder) : super(decoder);
1800 } 1816 }
1801 1817
1802 class InstanceGetterElementZ extends GetterElementZ 1818 class InstanceGetterElementZ extends GetterElementZ
1803 with ClassMemberMixin, InstanceMemberMixin { 1819 with ClassMemberMixin, InstanceMemberMixin {
1804 InstanceGetterElementZ(ObjectDecoder decoder) : super(decoder); 1820 InstanceGetterElementZ(ObjectDecoder decoder) : super(decoder);
1805 } 1821 }
1806 1822
1823 // ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
1807 abstract class SetterElementZ extends DeserializedElementZ 1824 abstract class SetterElementZ extends DeserializedElementZ
1808 with 1825 with
1809 AnalyzableElementMixin, 1826 AnalyzableElementMixin,
1810 AstElementMixinZ, 1827 AstElementMixinZ<FunctionExpression>,
1811 FunctionTypedElementMixin, 1828 FunctionTypedElementMixin,
1812 ParametersMixin, 1829 ParametersMixin,
1813 TypedElementMixin, 1830 TypedElementMixin<ResolutionFunctionType>,
1814 MemberElementMixin 1831 MemberElementMixin
1815 implements SetterElement { 1832 implements SetterElement {
1816 AbstractFieldElement abstractField; 1833 AbstractFieldElement abstractField;
1817 GetterElement getter; 1834 GetterElement getter;
1818 1835
1819 SetterElementZ(ObjectDecoder decoder) : super(decoder); 1836 SetterElementZ(ObjectDecoder decoder) : super(decoder);
1820 1837
1821 @override 1838 @override
1822 ElementKind get kind => ElementKind.SETTER; 1839 ElementKind get kind => ElementKind.SETTER;
1823 1840
(...skipping 16 matching lines...) Expand all
1840 class StaticSetterElementZ extends SetterElementZ 1857 class StaticSetterElementZ extends SetterElementZ
1841 with ClassMemberMixin, StaticMemberMixin { 1858 with ClassMemberMixin, StaticMemberMixin {
1842 StaticSetterElementZ(ObjectDecoder decoder) : super(decoder); 1859 StaticSetterElementZ(ObjectDecoder decoder) : super(decoder);
1843 } 1860 }
1844 1861
1845 class InstanceSetterElementZ extends SetterElementZ 1862 class InstanceSetterElementZ extends SetterElementZ
1846 with ClassMemberMixin, InstanceMemberMixin { 1863 with ClassMemberMixin, InstanceMemberMixin {
1847 InstanceSetterElementZ(ObjectDecoder decoder) : super(decoder); 1864 InstanceSetterElementZ(ObjectDecoder decoder) : super(decoder);
1848 } 1865 }
1849 1866
1850 abstract class TypeDeclarationMixin<T extends GenericType> 1867 abstract class TypeDeclarationMixin
1851 implements ElementZ, TypeDeclarationElement { 1868 implements ElementZ, TypeDeclarationElement {
1852 List<ResolutionDartType> _typeVariables; 1869 List<ResolutionDartType> _typeVariables;
1853 T _rawType; 1870 GenericType _rawType;
1854 T _thisType; 1871 GenericType _thisType;
1855 Name _memberName; 1872 Name _memberName;
1856 1873
1857 Name get memberName { 1874 Name get memberName {
1858 if (_memberName == null) { 1875 if (_memberName == null) {
1859 _memberName = new Name(name, library); 1876 _memberName = new Name(name, library);
1860 } 1877 }
1861 return _memberName; 1878 return _memberName;
1862 } 1879 }
1863 1880
1864 List<ResolutionDartType> _getTypeVariables(); 1881 List<ResolutionDartType> _getTypeVariables();
1865 1882
1866 void _ensureTypes() { 1883 void _ensureTypes() {
1867 if (_typeVariables == null) { 1884 if (_typeVariables == null) {
1868 _typeVariables = _getTypeVariables(); 1885 _typeVariables = _getTypeVariables();
1869 _rawType = _createType(new List<ResolutionDartType>.filled( 1886 _rawType = _createType(new List<ResolutionDartType>.filled(
1870 _typeVariables.length, const ResolutionDynamicType())); 1887 _typeVariables.length, const ResolutionDynamicType()));
1871 _thisType = _createType(_typeVariables); 1888 _thisType = _createType(_typeVariables);
1872 } 1889 }
1873 } 1890 }
1874 1891
1875 T _createType(List<ResolutionDartType> typeArguments); 1892 GenericType _createType(List<ResolutionDartType> typeArguments);
1876 1893
1877 @override 1894 @override
1878 List<ResolutionDartType> get typeVariables { 1895 List<ResolutionDartType> get typeVariables {
1879 _ensureTypes(); 1896 _ensureTypes();
1880 return _typeVariables; 1897 return _typeVariables;
1881 } 1898 }
1882 1899
1883 @override 1900 @override
1884 T get rawType { 1901 GenericType get rawType {
1885 _ensureTypes(); 1902 _ensureTypes();
1886 return _rawType; 1903 return _rawType;
1887 } 1904 }
1888 1905
1889 @override 1906 @override
1890 T get thisType { 1907 GenericType get thisType {
1891 _ensureTypes(); 1908 _ensureTypes();
1892 return _thisType; 1909 return _thisType;
1893 } 1910 }
1894 1911
1895 @override 1912 @override
1896 T computeType(Resolution resolution) => thisType; 1913 GenericType computeType(Resolution resolution) => thisType;
1897 1914
1898 @override 1915 @override
1899 bool get isResolved => true; 1916 bool get isResolved => true;
1900 } 1917 }
1901 1918
1902 class TypedefElementZ extends DeserializedElementZ 1919 class TypedefElementZ extends DeserializedElementZ
1903 with 1920 with
1904 AnalyzableElementMixin, 1921 AnalyzableElementMixin,
1905 AstElementMixinZ, 1922 AstElementMixinZ<Node>,
1906 LibraryMemberMixin, 1923 LibraryMemberMixin,
1907 ParametersMixin, 1924 ParametersMixin,
1908 TypeDeclarationMixin<ResolutionTypedefType> 1925 TypeDeclarationMixin
1909 implements TypedefElement { 1926 implements TypedefElement {
1910 ResolutionDartType _alias; 1927 ResolutionDartType _alias;
1911 1928
1912 TypedefElementZ(ObjectDecoder decoder) : super(decoder); 1929 TypedefElementZ(ObjectDecoder decoder) : super(decoder);
1913 1930
1914 ResolutionTypedefType _createType(List<ResolutionDartType> typeArguments) { 1931 ResolutionTypedefType _createType(List<ResolutionDartType> typeArguments) {
1915 return new ResolutionTypedefType(this, typeArguments); 1932 return new ResolutionTypedefType(this, typeArguments);
1916 } 1933 }
1917 1934
1918 @override 1935 @override
(...skipping 15 matching lines...) Expand all
1934 _alias = _decoder.getType(Key.ALIAS); 1951 _alias = _decoder.getType(Key.ALIAS);
1935 } 1952 }
1936 return _alias; 1953 return _alias;
1937 } 1954 }
1938 1955
1939 @override 1956 @override
1940 void ensureResolved(Resolution resolution) {} 1957 void ensureResolved(Resolution resolution) {}
1941 1958
1942 @override 1959 @override
1943 void checkCyclicReference(Resolution resolution) {} 1960 void checkCyclicReference(Resolution resolution) {}
1961
1962 ResolutionTypedefType get thisType => super.thisType;
1963
1964 ResolutionTypedefType get rawType => super.rawType;
1944 } 1965 }
1945 1966
1946 class TypeVariableElementZ extends DeserializedElementZ 1967 class TypeVariableElementZ extends DeserializedElementZ
1947 with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin 1968 with
1969 AnalyzableElementMixin,
1970 AstElementMixinZ<Node>,
1971 TypedElementMixin<ResolutionTypeVariableType>
1948 implements TypeVariableElement { 1972 implements TypeVariableElement {
1949 GenericElement _typeDeclaration; 1973 GenericElement _typeDeclaration;
1950 ResolutionTypeVariableType _type; 1974 ResolutionTypeVariableType _type;
1951 ResolutionDartType _bound; 1975 ResolutionDartType _bound;
1952 Name _memberName; 1976 Name _memberName;
1953 1977
1954 TypeVariableElementZ(ObjectDecoder decoder) : super(decoder); 1978 TypeVariableElementZ(ObjectDecoder decoder) : super(decoder);
1955 1979
1956 Name get memberName { 1980 Name get memberName {
1957 if (_memberName == null) { 1981 if (_memberName == null) {
(...skipping 12 matching lines...) Expand all
1970 1994
1971 @override 1995 @override
1972 CompilationUnitElement get compilationUnit { 1996 CompilationUnitElement get compilationUnit {
1973 return typeDeclaration.compilationUnit; 1997 return typeDeclaration.compilationUnit;
1974 } 1998 }
1975 1999
1976 @override 2000 @override
1977 Element get enclosingElement => typeDeclaration; 2001 Element get enclosingElement => typeDeclaration;
1978 2002
1979 @override 2003 @override
1980 Element get enclosingClass => typeDeclaration; 2004 ClassElementZ get enclosingClass => typeDeclaration;
1981 2005
1982 @override 2006 @override
1983 int get index => _decoder.getInt(Key.INDEX); 2007 int get index => _decoder.getInt(Key.INDEX);
1984 2008
1985 @override 2009 @override
1986 GenericElement get typeDeclaration { 2010 GenericElement get typeDeclaration {
1987 if (_typeDeclaration == null) { 2011 if (_typeDeclaration == null) {
1988 _typeDeclaration = _decoder.getElement(Key.TYPE_DECLARATION); 2012 _typeDeclaration = _decoder.getElement(Key.TYPE_DECLARATION);
1989 } 2013 }
1990 return _typeDeclaration; 2014 return _typeDeclaration;
1991 } 2015 }
1992 2016
1993 ResolutionDartType get bound { 2017 ResolutionDartType get bound {
1994 if (_bound == null) { 2018 if (_bound == null) {
1995 _bound = _decoder.getType(Key.BOUND); 2019 _bound = _decoder.getType(Key.BOUND);
1996 } 2020 }
1997 return _bound; 2021 return _bound;
1998 } 2022 }
1999 2023
2000 @override 2024 @override
2001 LibraryElement get library => typeDeclaration.library; 2025 LibraryElement get library => typeDeclaration.library;
2002 } 2026 }
2003 2027
2004 class SyntheticTypeVariableElementZ extends ElementZ 2028 class SyntheticTypeVariableElementZ extends ElementZ
2005 with AnalyzableElementMixin, AstElementMixinZ 2029 with AnalyzableElementMixin, AstElementMixinZ<Node>
2006 implements TypeVariableElement { 2030 implements TypeVariableElement {
2007 final TypeDeclarationElement typeDeclaration; 2031 final TypeDeclarationElement typeDeclaration;
2008 final int index; 2032 final int index;
2009 final String name; 2033 final String name;
2010 ResolutionTypeVariableType _type; 2034 ResolutionTypeVariableType _type;
2011 ResolutionDartType _bound; 2035 ResolutionDartType _bound;
2012 Name _memberName; 2036 Name _memberName;
2013 2037
2014 SyntheticTypeVariableElementZ(this.typeDeclaration, this.index, this.name); 2038 SyntheticTypeVariableElementZ(this.typeDeclaration, this.index, this.name);
2015 2039
(...skipping 24 matching lines...) Expand all
2040 return _type; 2064 return _type;
2041 } 2065 }
2042 2066
2043 @override 2067 @override
2044 ResolutionTypeVariableType computeType(Resolution resolution) => type; 2068 ResolutionTypeVariableType computeType(Resolution resolution) => type;
2045 2069
2046 @override 2070 @override
2047 Element get enclosingElement => typeDeclaration; 2071 Element get enclosingElement => typeDeclaration;
2048 2072
2049 @override 2073 @override
2050 Element get enclosingClass => typeDeclaration; 2074 ClassElementZ get enclosingClass => typeDeclaration;
2051 2075
2052 ResolutionDartType get bound { 2076 ResolutionDartType get bound {
2053 assert(_bound != null, 2077 assert(_bound != null,
2054 failedAt(this, "Type variable bound has not been set on $this.")); 2078 failedAt(this, "Type variable bound has not been set on $this."));
2055 return _bound; 2079 return _bound;
2056 } 2080 }
2057 2081
2058 @override 2082 @override
2059 LibraryElement get library => typeDeclaration.library; 2083 LibraryElement get library => typeDeclaration.library;
2060 2084
2061 @override 2085 @override
2062 int get sourceOffset => typeDeclaration.sourceOffset; 2086 int get sourceOffset => typeDeclaration.sourceOffset;
2063 2087
2064 @override 2088 @override
2065 SourceSpan get sourcePosition => typeDeclaration.sourcePosition; 2089 SourceSpan get sourcePosition => typeDeclaration.sourcePosition;
2066 } 2090 }
2067 2091
2068 abstract class ParameterElementZ extends DeserializedElementZ 2092 abstract class ParameterElementZ extends DeserializedElementZ
2069 with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin 2093 with
2094 AnalyzableElementMixin,
2095 AstElementMixinZ<VariableDefinitions>,
2096 TypedElementMixin
2070 implements ParameterElement { 2097 implements ParameterElement {
2071 FunctionElement _functionDeclaration; 2098 FunctionElement _functionDeclaration;
2072 ConstantExpression _constant; 2099 ConstantExpression _constant;
2073 ResolutionDartType _type; 2100 ResolutionDartType _type;
2074 2101
2075 ParameterElementZ(ObjectDecoder decoder) : super(decoder); 2102 ParameterElementZ(ObjectDecoder decoder) : super(decoder);
2076 2103
2077 @override 2104 @override
2078 bool get isFinal => _decoder.getBool(Key.IS_FINAL); 2105 bool get isFinal => _decoder.getBool(Key.IS_FINAL);
2079 2106
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 2142
2116 @override 2143 @override
2117 FunctionSignature get functionSignature => _unsupported('functionSignature'); 2144 FunctionSignature get functionSignature => _unsupported('functionSignature');
2118 2145
2119 // TODO(johnniwinther): Remove [initializer] and [node] on 2146 // TODO(johnniwinther): Remove [initializer] and [node] on
2120 // [ParameterElementZ] when the inference does need these. 2147 // [ParameterElementZ] when the inference does need these.
2121 @override 2148 @override
2122 Expression initializer; 2149 Expression initializer;
2123 2150
2124 @override 2151 @override
2125 Node node; 2152 VariableDefinitions node;
2126 2153
2127 @override 2154 @override
2128 bool get isNamed => _decoder.getBool(Key.IS_NAMED); 2155 bool get isNamed => _decoder.getBool(Key.IS_NAMED);
2129 2156
2130 @override 2157 @override
2131 bool get isOptional => _decoder.getBool(Key.IS_OPTIONAL); 2158 bool get isOptional => _decoder.getBool(Key.IS_OPTIONAL);
2132 2159
2133 @override 2160 @override
2134 LibraryElement get library => executableContext.library; 2161 LibraryElement get library => executableContext.library;
2135 2162
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 @override 2203 @override
2177 accept(ElementVisitor visitor, arg) { 2204 accept(ElementVisitor visitor, arg) {
2178 return visitor.visitFieldParameterElement(this, arg); 2205 return visitor.visitFieldParameterElement(this, arg);
2179 } 2206 }
2180 2207
2181 @override 2208 @override
2182 ElementKind get kind => ElementKind.INITIALIZING_FORMAL; 2209 ElementKind get kind => ElementKind.INITIALIZING_FORMAL;
2183 2210
2184 @override 2211 @override
2185 bool get isLocal => true; 2212 bool get isLocal => true;
2213
2214 ConstructorElementZ get functionDeclaration => super.functionDeclaration;
2186 } 2215 }
2187 2216
2188 class LocalVariableElementZ extends DeserializedElementZ 2217 class LocalVariableElementZ extends DeserializedElementZ
2189 with 2218 with
2190 AnalyzableElementMixin, 2219 AnalyzableElementMixin,
2191 AstElementMixinZ, 2220 AstElementMixinZ<VariableDefinitions>,
2192 LocalExecutableMixin, 2221 LocalExecutableMixin,
2193 TypedElementMixin 2222 TypedElementMixin
2194 implements LocalVariableElement { 2223 implements LocalVariableElement {
2195 bool _isConst; 2224 bool _isConst;
2196 ConstantExpression _constant; 2225 ConstantExpression _constant;
2197 2226
2198 LocalVariableElementZ(ObjectDecoder decoder) : super(decoder); 2227 LocalVariableElementZ(ObjectDecoder decoder) : super(decoder);
2199 2228
2200 @override 2229 @override
2201 accept(ElementVisitor visitor, arg) { 2230 accept(ElementVisitor visitor, arg) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 } 2441 }
2413 2442
2414 @override 2443 @override
2415 Node get node => throw new UnsupportedError('${this}.node'); 2444 Node get node => throw new UnsupportedError('${this}.node');
2416 2445
2417 @override 2446 @override
2418 bool get hasNode => false; 2447 bool get hasNode => false;
2419 2448
2420 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; 2449 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})';
2421 } 2450 }
OLDNEW
« 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