OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 15 matching lines...) Expand all Loading... |
26 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; | 26 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; |
27 import 'package:analyzer/src/generated/source.dart'; | 27 import 'package:analyzer/src/generated/source.dart'; |
28 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 28 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
29 import 'package:analyzer/src/generated/utilities_collection.dart'; | 29 import 'package:analyzer/src/generated/utilities_collection.dart'; |
30 import 'package:analyzer/src/generated/utilities_dart.dart'; | 30 import 'package:analyzer/src/generated/utilities_dart.dart'; |
31 import 'package:analyzer/src/generated/utilities_general.dart'; | 31 import 'package:analyzer/src/generated/utilities_general.dart'; |
32 import 'package:analyzer/src/summary/idl.dart'; | 32 import 'package:analyzer/src/summary/idl.dart'; |
33 import 'package:analyzer/src/task/dart.dart'; | 33 import 'package:analyzer/src/task/dart.dart'; |
34 | 34 |
35 /** | 35 /** |
| 36 * Assert that the given [object] is null, which in the places where this |
| 37 * function is called means that the element is not resynthesized. |
| 38 */ |
| 39 void _assertNotResynthesized(Object object) { |
| 40 // TODO(scheglov) I comment this check for now. |
| 41 // When we make a decision about switch to the new analysis driver, |
| 42 // we will need to rework the analysis code to don't call the setters |
| 43 // or restore / inline it. |
| 44 // assert(object == null); |
| 45 } |
| 46 |
| 47 /** |
36 * A concrete implementation of a [ClassElement]. | 48 * A concrete implementation of a [ClassElement]. |
37 */ | 49 */ |
38 abstract class AbstractClassElementImpl extends ElementImpl | 50 abstract class AbstractClassElementImpl extends ElementImpl |
39 implements ClassElement { | 51 implements ClassElement { |
40 /** | 52 /** |
41 * A list containing all of the accessors (getters and setters) contained in | 53 * A list containing all of the accessors (getters and setters) contained in |
42 * this class. | 54 * this class. |
43 */ | 55 */ |
44 List<PropertyAccessorElement> _accessors; | 56 List<PropertyAccessorElement> _accessors; |
45 | 57 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 * Initialize using the given serialized information. | 510 * Initialize using the given serialized information. |
499 */ | 511 */ |
500 ClassElementImpl.forSerialized( | 512 ClassElementImpl.forSerialized( |
501 this._unlinkedClass, CompilationUnitElementImpl enclosingUnit) | 513 this._unlinkedClass, CompilationUnitElementImpl enclosingUnit) |
502 : super.forSerialized(enclosingUnit); | 514 : super.forSerialized(enclosingUnit); |
503 | 515 |
504 /** | 516 /** |
505 * Set whether this class is abstract. | 517 * Set whether this class is abstract. |
506 */ | 518 */ |
507 void set abstract(bool isAbstract) { | 519 void set abstract(bool isAbstract) { |
508 assert(_unlinkedClass == null); | 520 _assertNotResynthesized(_unlinkedClass); |
509 setModifier(Modifier.ABSTRACT, isAbstract); | 521 setModifier(Modifier.ABSTRACT, isAbstract); |
510 } | 522 } |
511 | 523 |
512 @override | 524 @override |
513 List<PropertyAccessorElement> get accessors { | 525 List<PropertyAccessorElement> get accessors { |
514 if (_unlinkedClass != null && _accessors == null) { | 526 if (_unlinkedClass != null && _accessors == null) { |
515 _resynthesizeFieldsAndPropertyAccessors(); | 527 _resynthesizeFieldsAndPropertyAccessors(); |
516 } | 528 } |
517 return _accessors ?? const <PropertyAccessorElement>[]; | 529 return _accessors ?? const <PropertyAccessorElement>[]; |
518 } | 530 } |
519 | 531 |
520 @override | 532 @override |
521 void set accessors(List<PropertyAccessorElement> accessors) { | 533 void set accessors(List<PropertyAccessorElement> accessors) { |
522 assert(_unlinkedClass == null); | 534 _assertNotResynthesized(_unlinkedClass); |
523 super.accessors = accessors; | 535 super.accessors = accessors; |
524 } | 536 } |
525 | 537 |
526 @override | 538 @override |
527 List<InterfaceType> get allSupertypes { | 539 List<InterfaceType> get allSupertypes { |
528 List<InterfaceType> list = new List<InterfaceType>(); | 540 List<InterfaceType> list = new List<InterfaceType>(); |
529 _collectAllSupertypes(list); | 541 _collectAllSupertypes(list); |
530 return list; | 542 return list; |
531 } | 543 } |
532 | 544 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 assert(_constructors != null); | 579 assert(_constructors != null); |
568 return _constructors ?? const <ConstructorElement>[]; | 580 return _constructors ?? const <ConstructorElement>[]; |
569 } | 581 } |
570 | 582 |
571 /** | 583 /** |
572 * Set the constructors contained in this class to the given [constructors]. | 584 * Set the constructors contained in this class to the given [constructors]. |
573 * | 585 * |
574 * Should only be used for class elements that are not mixin applications. | 586 * Should only be used for class elements that are not mixin applications. |
575 */ | 587 */ |
576 void set constructors(List<ConstructorElement> constructors) { | 588 void set constructors(List<ConstructorElement> constructors) { |
577 assert(_unlinkedClass == null); | 589 _assertNotResynthesized(_unlinkedClass); |
578 assert(!isMixinApplication); | 590 assert(!isMixinApplication); |
579 for (ConstructorElement constructor in constructors) { | 591 for (ConstructorElement constructor in constructors) { |
580 (constructor as ConstructorElementImpl).enclosingElement = this; | 592 (constructor as ConstructorElementImpl).enclosingElement = this; |
581 } | 593 } |
582 this._constructors = constructors; | 594 this._constructors = constructors; |
583 } | 595 } |
584 | 596 |
585 @override | 597 @override |
586 String get documentationComment { | 598 String get documentationComment { |
587 if (_unlinkedClass != null) { | 599 if (_unlinkedClass != null) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 @override | 652 @override |
641 List<FieldElement> get fields { | 653 List<FieldElement> get fields { |
642 if (_unlinkedClass != null && _fields == null) { | 654 if (_unlinkedClass != null && _fields == null) { |
643 _resynthesizeFieldsAndPropertyAccessors(); | 655 _resynthesizeFieldsAndPropertyAccessors(); |
644 } | 656 } |
645 return _fields ?? const <FieldElement>[]; | 657 return _fields ?? const <FieldElement>[]; |
646 } | 658 } |
647 | 659 |
648 @override | 660 @override |
649 void set fields(List<FieldElement> fields) { | 661 void set fields(List<FieldElement> fields) { |
650 assert(_unlinkedClass == null); | 662 _assertNotResynthesized(_unlinkedClass); |
651 super.fields = fields; | 663 super.fields = fields; |
652 } | 664 } |
653 | 665 |
654 bool get hasBeenInferred { | 666 bool get hasBeenInferred { |
655 if (_unlinkedClass != null) { | 667 if (_unlinkedClass != null) { |
656 return context.analysisOptions.strongMode; | 668 return context.analysisOptions.strongMode; |
657 } | 669 } |
658 return _hasBeenInferred; | 670 return _hasBeenInferred; |
659 } | 671 } |
660 | 672 |
661 void set hasBeenInferred(bool hasBeenInferred) { | 673 void set hasBeenInferred(bool hasBeenInferred) { |
662 assert(_unlinkedClass == null); | 674 _assertNotResynthesized(_unlinkedClass); |
663 _hasBeenInferred = hasBeenInferred; | 675 _hasBeenInferred = hasBeenInferred; |
664 } | 676 } |
665 | 677 |
666 @override | 678 @override |
667 bool get hasNonFinalField { | 679 bool get hasNonFinalField { |
668 List<ClassElement> classesToVisit = new List<ClassElement>(); | 680 List<ClassElement> classesToVisit = new List<ClassElement>(); |
669 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); | 681 HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>(); |
670 classesToVisit.add(this); | 682 classesToVisit.add(this); |
671 while (!classesToVisit.isEmpty) { | 683 while (!classesToVisit.isEmpty) { |
672 ClassElement currentElement = classesToVisit.removeAt(0); | 684 ClassElement currentElement = classesToVisit.removeAt(0); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 754 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
743 _interfaces = _unlinkedClass.interfaces | 755 _interfaces = _unlinkedClass.interfaces |
744 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 756 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
745 .where((DartType type) => type is InterfaceType) | 757 .where((DartType type) => type is InterfaceType) |
746 .toList(growable: false); | 758 .toList(growable: false); |
747 } | 759 } |
748 return _interfaces ?? const <InterfaceType>[]; | 760 return _interfaces ?? const <InterfaceType>[]; |
749 } | 761 } |
750 | 762 |
751 void set interfaces(List<InterfaceType> interfaces) { | 763 void set interfaces(List<InterfaceType> interfaces) { |
752 assert(_unlinkedClass == null); | 764 _assertNotResynthesized(_unlinkedClass); |
753 _interfaces = interfaces; | 765 _interfaces = interfaces; |
754 } | 766 } |
755 | 767 |
756 @override | 768 @override |
757 bool get isAbstract { | 769 bool get isAbstract { |
758 if (_unlinkedClass != null) { | 770 if (_unlinkedClass != null) { |
759 return _unlinkedClass.isAbstract; | 771 return _unlinkedClass.isAbstract; |
760 } | 772 } |
761 return hasModifier(Modifier.ABSTRACT); | 773 return hasModifier(Modifier.ABSTRACT); |
762 } | 774 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 .map((e) => new MethodElementImpl.forSerialized(e, this)) | 833 .map((e) => new MethodElementImpl.forSerialized(e, this)) |
822 .toList(growable: false); | 834 .toList(growable: false); |
823 } | 835 } |
824 return _methods ?? const <MethodElement>[]; | 836 return _methods ?? const <MethodElement>[]; |
825 } | 837 } |
826 | 838 |
827 /** | 839 /** |
828 * Set the methods contained in this class to the given [methods]. | 840 * Set the methods contained in this class to the given [methods]. |
829 */ | 841 */ |
830 void set methods(List<MethodElement> methods) { | 842 void set methods(List<MethodElement> methods) { |
831 assert(_unlinkedClass == null); | 843 _assertNotResynthesized(_unlinkedClass); |
832 for (MethodElement method in methods) { | 844 for (MethodElement method in methods) { |
833 (method as MethodElementImpl).enclosingElement = this; | 845 (method as MethodElementImpl).enclosingElement = this; |
834 } | 846 } |
835 _methods = methods; | 847 _methods = methods; |
836 } | 848 } |
837 | 849 |
838 /** | 850 /** |
839 * Set whether this class is a mixin application. | 851 * Set whether this class is a mixin application. |
840 */ | 852 */ |
841 void set mixinApplication(bool isMixinApplication) { | 853 void set mixinApplication(bool isMixinApplication) { |
842 assert(_unlinkedClass == null); | 854 _assertNotResynthesized(_unlinkedClass); |
843 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); | 855 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); |
844 } | 856 } |
845 | 857 |
846 @override | 858 @override |
847 List<InterfaceType> get mixins { | 859 List<InterfaceType> get mixins { |
848 if (_unlinkedClass != null && _mixins == null) { | 860 if (_unlinkedClass != null && _mixins == null) { |
849 ResynthesizerContext context = enclosingUnit.resynthesizerContext; | 861 ResynthesizerContext context = enclosingUnit.resynthesizerContext; |
850 _mixins = _unlinkedClass.mixins | 862 _mixins = _unlinkedClass.mixins |
851 .map((EntityRef t) => context.resolveTypeRef(t, this)) | 863 .map((EntityRef t) => context.resolveTypeRef(t, this)) |
852 .where((DartType type) => type is InterfaceType) | 864 .where((DartType type) => type is InterfaceType) |
853 .toList(growable: false); | 865 .toList(growable: false); |
854 } | 866 } |
855 return _mixins ?? const <InterfaceType>[]; | 867 return _mixins ?? const <InterfaceType>[]; |
856 } | 868 } |
857 | 869 |
858 void set mixins(List<InterfaceType> mixins) { | 870 void set mixins(List<InterfaceType> mixins) { |
859 assert(_unlinkedClass == null); | 871 _assertNotResynthesized(_unlinkedClass); |
860 _mixins = mixins; | 872 _mixins = mixins; |
861 } | 873 } |
862 | 874 |
863 @override | 875 @override |
864 String get name { | 876 String get name { |
865 if (_unlinkedClass != null) { | 877 if (_unlinkedClass != null) { |
866 return _unlinkedClass.name; | 878 return _unlinkedClass.name; |
867 } | 879 } |
868 return super.name; | 880 return super.name; |
869 } | 881 } |
(...skipping 21 matching lines...) Expand all Loading... |
891 } else if (_unlinkedClass.hasNoSupertype) { | 903 } else if (_unlinkedClass.hasNoSupertype) { |
892 return null; | 904 return null; |
893 } else { | 905 } else { |
894 _supertype = context.typeProvider.objectType; | 906 _supertype = context.typeProvider.objectType; |
895 } | 907 } |
896 } | 908 } |
897 return _supertype; | 909 return _supertype; |
898 } | 910 } |
899 | 911 |
900 void set supertype(InterfaceType supertype) { | 912 void set supertype(InterfaceType supertype) { |
901 assert(_unlinkedClass == null); | 913 _assertNotResynthesized(_unlinkedClass); |
902 _supertype = supertype; | 914 _supertype = supertype; |
903 } | 915 } |
904 | 916 |
905 @override | 917 @override |
906 InterfaceType get type { | 918 InterfaceType get type { |
907 if (_type == null) { | 919 if (_type == null) { |
908 InterfaceTypeImpl type = new InterfaceTypeImpl(this); | 920 InterfaceTypeImpl type = new InterfaceTypeImpl(this); |
909 type.typeArguments = typeParameterTypes; | 921 type.typeArguments = typeParameterTypes; |
910 _type = type; | 922 _type = type; |
911 } | 923 } |
912 return _type; | 924 return _type; |
913 } | 925 } |
914 | 926 |
915 @override | 927 @override |
916 TypeParameterizedElementMixin get typeParameterContext => this; | 928 TypeParameterizedElementMixin get typeParameterContext => this; |
917 | 929 |
918 @override | 930 @override |
919 List<TypeParameterElement> get typeParameters { | 931 List<TypeParameterElement> get typeParameters { |
920 if (_unlinkedClass != null) { | 932 if (_unlinkedClass != null) { |
921 return super.typeParameters; | 933 return super.typeParameters; |
922 } | 934 } |
923 return _typeParameters; | 935 return _typeParameters; |
924 } | 936 } |
925 | 937 |
926 /** | 938 /** |
927 * Set the type parameters defined for this class to the given | 939 * Set the type parameters defined for this class to the given |
928 * [typeParameters]. | 940 * [typeParameters]. |
929 */ | 941 */ |
930 void set typeParameters(List<TypeParameterElement> typeParameters) { | 942 void set typeParameters(List<TypeParameterElement> typeParameters) { |
931 assert(_unlinkedClass == null); | 943 _assertNotResynthesized(_unlinkedClass); |
932 for (TypeParameterElement typeParameter in typeParameters) { | 944 for (TypeParameterElement typeParameter in typeParameters) { |
933 (typeParameter as TypeParameterElementImpl).enclosingElement = this; | 945 (typeParameter as TypeParameterElementImpl).enclosingElement = this; |
934 } | 946 } |
935 this._typeParameters = typeParameters; | 947 this._typeParameters = typeParameters; |
936 } | 948 } |
937 | 949 |
938 @override | 950 @override |
939 List<UnlinkedTypeParam> get unlinkedTypeParams => | 951 List<UnlinkedTypeParam> get unlinkedTypeParams => |
940 _unlinkedClass.typeParameters; | 952 _unlinkedClass.typeParameters; |
941 | 953 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 .map((e) => new EnumElementImpl.forSerialized(e, this)) | 1483 .map((e) => new EnumElementImpl.forSerialized(e, this)) |
1472 .toList(growable: false); | 1484 .toList(growable: false); |
1473 } | 1485 } |
1474 return _enums ?? const <ClassElement>[]; | 1486 return _enums ?? const <ClassElement>[]; |
1475 } | 1487 } |
1476 | 1488 |
1477 /** | 1489 /** |
1478 * Set the enums contained in this compilation unit to the given [enums]. | 1490 * Set the enums contained in this compilation unit to the given [enums]. |
1479 */ | 1491 */ |
1480 void set enums(List<ClassElement> enums) { | 1492 void set enums(List<ClassElement> enums) { |
1481 assert(_unlinkedUnit == null); | 1493 _assertNotResynthesized(_unlinkedUnit); |
1482 for (ClassElement enumDeclaration in enums) { | 1494 for (ClassElement enumDeclaration in enums) { |
1483 (enumDeclaration as EnumElementImpl).enclosingElement = this; | 1495 (enumDeclaration as EnumElementImpl).enclosingElement = this; |
1484 } | 1496 } |
1485 this._enums = enums; | 1497 this._enums = enums; |
1486 } | 1498 } |
1487 | 1499 |
1488 @override | 1500 @override |
1489 List<FunctionElement> get functions { | 1501 List<FunctionElement> get functions { |
1490 if (_unlinkedUnit != null) { | 1502 if (_unlinkedUnit != null) { |
1491 _functions ??= _unlinkedUnit.executables | 1503 _functions ??= _unlinkedUnit.executables |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 (field as TopLevelVariableElementImpl).enclosingElement = this; | 1597 (field as TopLevelVariableElementImpl).enclosingElement = this; |
1586 } | 1598 } |
1587 this._variables = variables; | 1599 this._variables = variables; |
1588 } | 1600 } |
1589 | 1601 |
1590 /** | 1602 /** |
1591 * Set the function type aliases contained in this compilation unit to the | 1603 * Set the function type aliases contained in this compilation unit to the |
1592 * given [typeAliases]. | 1604 * given [typeAliases]. |
1593 */ | 1605 */ |
1594 void set typeAliases(List<FunctionTypeAliasElement> typeAliases) { | 1606 void set typeAliases(List<FunctionTypeAliasElement> typeAliases) { |
1595 assert(_unlinkedUnit == null); | 1607 _assertNotResynthesized(_unlinkedUnit); |
1596 for (FunctionTypeAliasElement typeAlias in typeAliases) { | 1608 for (FunctionTypeAliasElement typeAlias in typeAliases) { |
1597 (typeAlias as FunctionTypeAliasElementImpl).enclosingElement = this; | 1609 (typeAlias as FunctionTypeAliasElementImpl).enclosingElement = this; |
1598 } | 1610 } |
1599 this._typeAliases = typeAliases; | 1611 this._typeAliases = typeAliases; |
1600 } | 1612 } |
1601 | 1613 |
1602 @override | 1614 @override |
1603 TypeParameterizedElementMixin get typeParameterContext => null; | 1615 TypeParameterizedElementMixin get typeParameterContext => null; |
1604 | 1616 |
1605 @override | 1617 @override |
1606 List<ClassElement> get types { | 1618 List<ClassElement> get types { |
1607 if (_unlinkedUnit != null) { | 1619 if (_unlinkedUnit != null) { |
1608 _types ??= _unlinkedUnit.classes | 1620 _types ??= _unlinkedUnit.classes |
1609 .map((c) => new ClassElementImpl.forSerialized(c, this)) | 1621 .map((c) => new ClassElementImpl.forSerialized(c, this)) |
1610 .toList(growable: false); | 1622 .toList(growable: false); |
1611 } | 1623 } |
1612 return _types ?? const <ClassElement>[]; | 1624 return _types ?? const <ClassElement>[]; |
1613 } | 1625 } |
1614 | 1626 |
1615 /** | 1627 /** |
1616 * Set the types contained in this compilation unit to the given [types]. | 1628 * Set the types contained in this compilation unit to the given [types]. |
1617 */ | 1629 */ |
1618 void set types(List<ClassElement> types) { | 1630 void set types(List<ClassElement> types) { |
1619 assert(_unlinkedUnit == null); | 1631 _assertNotResynthesized(_unlinkedUnit); |
1620 for (ClassElement type in types) { | 1632 for (ClassElement type in types) { |
1621 // Another implementation of ClassElement is _DeferredClassElement, | 1633 // Another implementation of ClassElement is _DeferredClassElement, |
1622 // which is used to resynthesize classes lazily. We cannot cast it | 1634 // which is used to resynthesize classes lazily. We cannot cast it |
1623 // to ClassElementImpl, and it already can provide correct values of the | 1635 // to ClassElementImpl, and it already can provide correct values of the |
1624 // 'enclosingElement' property. | 1636 // 'enclosingElement' property. |
1625 if (type is ClassElementImpl) { | 1637 if (type is ClassElementImpl) { |
1626 type.enclosingElement = this; | 1638 type.enclosingElement = this; |
1627 } | 1639 } |
1628 } | 1640 } |
1629 this._types = types; | 1641 this._types = types; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 * Initialize using the given serialized information. | 2027 * Initialize using the given serialized information. |
2016 */ | 2028 */ |
2017 ConstructorElementImpl.forSerialized( | 2029 ConstructorElementImpl.forSerialized( |
2018 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass) | 2030 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass) |
2019 : super.forSerialized(serializedExecutable, enclosingClass); | 2031 : super.forSerialized(serializedExecutable, enclosingClass); |
2020 | 2032 |
2021 /** | 2033 /** |
2022 * Set whether this constructor represents a 'const' constructor. | 2034 * Set whether this constructor represents a 'const' constructor. |
2023 */ | 2035 */ |
2024 void set const2(bool isConst) { | 2036 void set const2(bool isConst) { |
2025 assert(serializedExecutable == null); | 2037 _assertNotResynthesized(serializedExecutable); |
2026 setModifier(Modifier.CONST, isConst); | 2038 setModifier(Modifier.CONST, isConst); |
2027 } | 2039 } |
2028 | 2040 |
2029 List<ConstructorInitializer> get constantInitializers { | 2041 List<ConstructorInitializer> get constantInitializers { |
2030 if (serializedExecutable != null && _constantInitializers == null) { | 2042 if (serializedExecutable != null && _constantInitializers == null) { |
2031 _constantInitializers ??= serializedExecutable.constantInitializers | 2043 _constantInitializers ??= serializedExecutable.constantInitializers |
2032 .map((i) => _buildConstructorInitializer(i)) | 2044 .map((i) => _buildConstructorInitializer(i)) |
2033 .toList(growable: false); | 2045 .toList(growable: false); |
2034 } | 2046 } |
2035 return _constantInitializers; | 2047 return _constantInitializers; |
2036 } | 2048 } |
2037 | 2049 |
2038 void set constantInitializers( | 2050 void set constantInitializers( |
2039 List<ConstructorInitializer> constantInitializers) { | 2051 List<ConstructorInitializer> constantInitializers) { |
2040 assert(serializedExecutable == null); | 2052 _assertNotResynthesized(serializedExecutable); |
2041 _constantInitializers = constantInitializers; | 2053 _constantInitializers = constantInitializers; |
2042 } | 2054 } |
2043 | 2055 |
2044 @override | 2056 @override |
2045 ClassElementImpl get enclosingElement => | 2057 ClassElementImpl get enclosingElement => |
2046 super.enclosingElement as ClassElementImpl; | 2058 super.enclosingElement as ClassElementImpl; |
2047 | 2059 |
2048 @override | 2060 @override |
2049 TypeParameterizedElementMixin get enclosingTypeParameterContext => | 2061 TypeParameterizedElementMixin get enclosingTypeParameterContext => |
2050 super.enclosingElement as ClassElementImpl; | 2062 super.enclosingElement as ClassElementImpl; |
2051 | 2063 |
2052 /** | 2064 /** |
2053 * Set whether this constructor represents a factory method. | 2065 * Set whether this constructor represents a factory method. |
2054 */ | 2066 */ |
2055 void set factory(bool isFactory) { | 2067 void set factory(bool isFactory) { |
2056 assert(serializedExecutable == null); | 2068 _assertNotResynthesized(serializedExecutable); |
2057 setModifier(Modifier.FACTORY, isFactory); | 2069 setModifier(Modifier.FACTORY, isFactory); |
2058 } | 2070 } |
2059 | 2071 |
2060 @override | 2072 @override |
2061 bool get isConst { | 2073 bool get isConst { |
2062 if (serializedExecutable != null) { | 2074 if (serializedExecutable != null) { |
2063 return serializedExecutable.isConst; | 2075 return serializedExecutable.isConst; |
2064 } | 2076 } |
2065 return hasModifier(Modifier.CONST); | 2077 return hasModifier(Modifier.CONST); |
2066 } | 2078 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 if (serializedExecutable.name.isNotEmpty) { | 2129 if (serializedExecutable.name.isNotEmpty) { |
2118 return serializedExecutable.nameEnd; | 2130 return serializedExecutable.nameEnd; |
2119 } else { | 2131 } else { |
2120 return serializedExecutable.nameOffset + enclosingElement.name.length; | 2132 return serializedExecutable.nameOffset + enclosingElement.name.length; |
2121 } | 2133 } |
2122 } | 2134 } |
2123 return _nameEnd; | 2135 return _nameEnd; |
2124 } | 2136 } |
2125 | 2137 |
2126 void set nameEnd(int nameEnd) { | 2138 void set nameEnd(int nameEnd) { |
2127 assert(serializedExecutable == null); | 2139 _assertNotResynthesized(serializedExecutable); |
2128 _nameEnd = nameEnd; | 2140 _nameEnd = nameEnd; |
2129 } | 2141 } |
2130 | 2142 |
2131 @override | 2143 @override |
2132 int get periodOffset { | 2144 int get periodOffset { |
2133 if (serializedExecutable != null) { | 2145 if (serializedExecutable != null) { |
2134 if (serializedExecutable.name.isNotEmpty) { | 2146 if (serializedExecutable.name.isNotEmpty) { |
2135 return serializedExecutable.periodOffset; | 2147 return serializedExecutable.periodOffset; |
2136 } | 2148 } |
2137 } | 2149 } |
2138 return _periodOffset; | 2150 return _periodOffset; |
2139 } | 2151 } |
2140 | 2152 |
2141 void set periodOffset(int periodOffset) { | 2153 void set periodOffset(int periodOffset) { |
2142 assert(serializedExecutable == null); | 2154 _assertNotResynthesized(serializedExecutable); |
2143 _periodOffset = periodOffset; | 2155 _periodOffset = periodOffset; |
2144 } | 2156 } |
2145 | 2157 |
2146 @override | 2158 @override |
2147 ConstructorElement get redirectedConstructor { | 2159 ConstructorElement get redirectedConstructor { |
2148 if (serializedExecutable != null && _redirectedConstructor == null) { | 2160 if (serializedExecutable != null && _redirectedConstructor == null) { |
2149 if (serializedExecutable.isRedirectedConstructor) { | 2161 if (serializedExecutable.isRedirectedConstructor) { |
2150 if (serializedExecutable.isFactory) { | 2162 if (serializedExecutable.isFactory) { |
2151 _redirectedConstructor = enclosingUnit.resynthesizerContext | 2163 _redirectedConstructor = enclosingUnit.resynthesizerContext |
2152 .resolveConstructorRef( | 2164 .resolveConstructorRef( |
2153 enclosingElement, serializedExecutable.redirectedConstructor); | 2165 enclosingElement, serializedExecutable.redirectedConstructor); |
2154 } else { | 2166 } else { |
2155 _redirectedConstructor = enclosingElement.getNamedConstructor( | 2167 _redirectedConstructor = enclosingElement.getNamedConstructor( |
2156 serializedExecutable.redirectedConstructorName); | 2168 serializedExecutable.redirectedConstructorName); |
2157 } | 2169 } |
2158 } else { | 2170 } else { |
2159 return null; | 2171 return null; |
2160 } | 2172 } |
2161 } | 2173 } |
2162 return _redirectedConstructor; | 2174 return _redirectedConstructor; |
2163 } | 2175 } |
2164 | 2176 |
2165 void set redirectedConstructor(ConstructorElement redirectedConstructor) { | 2177 void set redirectedConstructor(ConstructorElement redirectedConstructor) { |
2166 assert(serializedExecutable == null); | 2178 _assertNotResynthesized(serializedExecutable); |
2167 _redirectedConstructor = redirectedConstructor; | 2179 _redirectedConstructor = redirectedConstructor; |
2168 } | 2180 } |
2169 | 2181 |
2170 @override | 2182 @override |
2171 DartType get returnType => enclosingElement.type; | 2183 DartType get returnType => enclosingElement.type; |
2172 | 2184 |
2173 void set returnType(DartType returnType) { | 2185 void set returnType(DartType returnType) { |
2174 assert(false); | 2186 assert(false); |
2175 } | 2187 } |
2176 | 2188 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 | 2340 |
2329 Expression get constantInitializer { | 2341 Expression get constantInitializer { |
2330 if (_constantInitializer == null && _unlinkedConst != null) { | 2342 if (_constantInitializer == null && _unlinkedConst != null) { |
2331 _constantInitializer = enclosingUnit.resynthesizerContext | 2343 _constantInitializer = enclosingUnit.resynthesizerContext |
2332 .buildExpression(this, _unlinkedConst); | 2344 .buildExpression(this, _unlinkedConst); |
2333 } | 2345 } |
2334 return _constantInitializer; | 2346 return _constantInitializer; |
2335 } | 2347 } |
2336 | 2348 |
2337 void set constantInitializer(Expression constantInitializer) { | 2349 void set constantInitializer(Expression constantInitializer) { |
2338 assert(_unlinkedConst == null); | 2350 _assertNotResynthesized(_unlinkedConst); |
2339 _constantInitializer = constantInitializer; | 2351 _constantInitializer = constantInitializer; |
2340 } | 2352 } |
2341 | 2353 |
2342 EvaluationResultImpl get evaluationResult => _evaluationResult; | 2354 EvaluationResultImpl get evaluationResult => _evaluationResult; |
2343 | 2355 |
2344 void set evaluationResult(EvaluationResultImpl evaluationResult) { | 2356 void set evaluationResult(EvaluationResultImpl evaluationResult) { |
2345 _evaluationResult = evaluationResult; | 2357 _evaluationResult = evaluationResult; |
2346 } | 2358 } |
2347 | 2359 |
2348 /** | 2360 /** |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3351 * Initialize using the given serialized information. | 3363 * Initialize using the given serialized information. |
3352 */ | 3364 */ |
3353 EnumElementImpl.forSerialized( | 3365 EnumElementImpl.forSerialized( |
3354 this._unlinkedEnum, CompilationUnitElementImpl enclosingUnit) | 3366 this._unlinkedEnum, CompilationUnitElementImpl enclosingUnit) |
3355 : super.forSerialized(enclosingUnit); | 3367 : super.forSerialized(enclosingUnit); |
3356 | 3368 |
3357 /** | 3369 /** |
3358 * Set whether this class is abstract. | 3370 * Set whether this class is abstract. |
3359 */ | 3371 */ |
3360 void set abstract(bool isAbstract) { | 3372 void set abstract(bool isAbstract) { |
3361 assert(_unlinkedEnum == null); | 3373 _assertNotResynthesized(_unlinkedEnum); |
3362 } | 3374 } |
3363 | 3375 |
3364 @override | 3376 @override |
3365 List<PropertyAccessorElement> get accessors { | 3377 List<PropertyAccessorElement> get accessors { |
3366 if (_unlinkedEnum != null && _accessors == null) { | 3378 if (_unlinkedEnum != null && _accessors == null) { |
3367 _resynthesizeFieldsAndPropertyAccessors(); | 3379 _resynthesizeFieldsAndPropertyAccessors(); |
3368 } | 3380 } |
3369 return _accessors ?? const <PropertyAccessorElement>[]; | 3381 return _accessors ?? const <PropertyAccessorElement>[]; |
3370 } | 3382 } |
3371 | 3383 |
3372 @override | 3384 @override |
3373 void set accessors(List<PropertyAccessorElement> accessors) { | 3385 void set accessors(List<PropertyAccessorElement> accessors) { |
3374 assert(_unlinkedEnum == null); | 3386 _assertNotResynthesized(_unlinkedEnum); |
3375 super.accessors = accessors; | 3387 super.accessors = accessors; |
3376 } | 3388 } |
3377 | 3389 |
3378 @override | 3390 @override |
3379 List<InterfaceType> get allSupertypes => <InterfaceType>[supertype]; | 3391 List<InterfaceType> get allSupertypes => <InterfaceType>[supertype]; |
3380 | 3392 |
3381 @override | 3393 @override |
3382 int get codeLength { | 3394 int get codeLength { |
3383 if (_unlinkedEnum != null) { | 3395 if (_unlinkedEnum != null) { |
3384 return _unlinkedEnum.codeRange?.length; | 3396 return _unlinkedEnum.codeRange?.length; |
(...skipping 29 matching lines...) Expand all Loading... |
3414 @override | 3426 @override |
3415 List<FieldElement> get fields { | 3427 List<FieldElement> get fields { |
3416 if (_unlinkedEnum != null && _fields == null) { | 3428 if (_unlinkedEnum != null && _fields == null) { |
3417 _resynthesizeFieldsAndPropertyAccessors(); | 3429 _resynthesizeFieldsAndPropertyAccessors(); |
3418 } | 3430 } |
3419 return _fields ?? const <FieldElement>[]; | 3431 return _fields ?? const <FieldElement>[]; |
3420 } | 3432 } |
3421 | 3433 |
3422 @override | 3434 @override |
3423 void set fields(List<FieldElement> fields) { | 3435 void set fields(List<FieldElement> fields) { |
3424 assert(_unlinkedEnum == null); | 3436 _assertNotResynthesized(_unlinkedEnum); |
3425 super.fields = fields; | 3437 super.fields = fields; |
3426 } | 3438 } |
3427 | 3439 |
3428 @override | 3440 @override |
3429 bool get hasNonFinalField => false; | 3441 bool get hasNonFinalField => false; |
3430 | 3442 |
3431 @override | 3443 @override |
3432 bool get hasReferenceToSuper => false; | 3444 bool get hasReferenceToSuper => false; |
3433 | 3445 |
3434 @override | 3446 @override |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3622 * Initialize using the given serialized information. | 3634 * Initialize using the given serialized information. |
3623 */ | 3635 */ |
3624 ExecutableElementImpl.forSerialized( | 3636 ExecutableElementImpl.forSerialized( |
3625 this.serializedExecutable, ElementImpl enclosingElement) | 3637 this.serializedExecutable, ElementImpl enclosingElement) |
3626 : super.forSerialized(enclosingElement); | 3638 : super.forSerialized(enclosingElement); |
3627 | 3639 |
3628 /** | 3640 /** |
3629 * Set whether this executable element's body is asynchronous. | 3641 * Set whether this executable element's body is asynchronous. |
3630 */ | 3642 */ |
3631 void set asynchronous(bool isAsynchronous) { | 3643 void set asynchronous(bool isAsynchronous) { |
3632 assert(serializedExecutable == null); | 3644 _assertNotResynthesized(serializedExecutable); |
3633 setModifier(Modifier.ASYNCHRONOUS, isAsynchronous); | 3645 setModifier(Modifier.ASYNCHRONOUS, isAsynchronous); |
3634 } | 3646 } |
3635 | 3647 |
3636 @override | 3648 @override |
3637 int get codeLength { | 3649 int get codeLength { |
3638 if (serializedExecutable != null) { | 3650 if (serializedExecutable != null) { |
3639 return serializedExecutable.codeRange?.length; | 3651 return serializedExecutable.codeRange?.length; |
3640 } | 3652 } |
3641 return super.codeLength; | 3653 return super.codeLength; |
3642 } | 3654 } |
(...skipping 19 matching lines...) Expand all Loading... |
3662 if (serializedExecutable != null) { | 3674 if (serializedExecutable != null) { |
3663 return serializedExecutable?.documentationComment?.text; | 3675 return serializedExecutable?.documentationComment?.text; |
3664 } | 3676 } |
3665 return super.documentationComment; | 3677 return super.documentationComment; |
3666 } | 3678 } |
3667 | 3679 |
3668 /** | 3680 /** |
3669 * Set whether this executable element is external. | 3681 * Set whether this executable element is external. |
3670 */ | 3682 */ |
3671 void set external(bool isExternal) { | 3683 void set external(bool isExternal) { |
3672 assert(serializedExecutable == null); | 3684 _assertNotResynthesized(serializedExecutable); |
3673 setModifier(Modifier.EXTERNAL, isExternal); | 3685 setModifier(Modifier.EXTERNAL, isExternal); |
3674 } | 3686 } |
3675 | 3687 |
3676 @override | 3688 @override |
3677 List<FunctionElement> get functions { | 3689 List<FunctionElement> get functions { |
3678 if (serializedExecutable != null) { | 3690 if (serializedExecutable != null) { |
3679 _functions ??= FunctionElementImpl.resynthesizeList( | 3691 _functions ??= FunctionElementImpl.resynthesizeList( |
3680 this, serializedExecutable.localFunctions); | 3692 this, serializedExecutable.localFunctions); |
3681 } | 3693 } |
3682 return _functions ?? const <FunctionElement>[]; | 3694 return _functions ?? const <FunctionElement>[]; |
3683 } | 3695 } |
3684 | 3696 |
3685 /** | 3697 /** |
3686 * Set the functions defined within this executable element to the given | 3698 * Set the functions defined within this executable element to the given |
3687 * [functions]. | 3699 * [functions]. |
3688 */ | 3700 */ |
3689 void set functions(List<FunctionElement> functions) { | 3701 void set functions(List<FunctionElement> functions) { |
3690 assert(serializedExecutable == null); | 3702 _assertNotResynthesized(serializedExecutable); |
3691 for (FunctionElement function in functions) { | 3703 for (FunctionElement function in functions) { |
3692 (function as FunctionElementImpl).enclosingElement = this; | 3704 (function as FunctionElementImpl).enclosingElement = this; |
3693 } | 3705 } |
3694 this._functions = functions; | 3706 this._functions = functions; |
3695 } | 3707 } |
3696 | 3708 |
3697 /** | 3709 /** |
3698 * Set whether this method's body is a generator. | 3710 * Set whether this method's body is a generator. |
3699 */ | 3711 */ |
3700 void set generator(bool isGenerator) { | 3712 void set generator(bool isGenerator) { |
3701 assert(serializedExecutable == null); | 3713 _assertNotResynthesized(serializedExecutable); |
3702 setModifier(Modifier.GENERATOR, isGenerator); | 3714 setModifier(Modifier.GENERATOR, isGenerator); |
3703 } | 3715 } |
3704 | 3716 |
3705 @override | 3717 @override |
3706 bool get hasImplicitReturnType { | 3718 bool get hasImplicitReturnType { |
3707 if (serializedExecutable != null) { | 3719 if (serializedExecutable != null) { |
3708 return serializedExecutable.returnType == null && | 3720 return serializedExecutable.returnType == null && |
3709 serializedExecutable.kind != UnlinkedExecutableKind.constructor; | 3721 serializedExecutable.kind != UnlinkedExecutableKind.constructor; |
3710 } | 3722 } |
3711 return hasModifier(Modifier.IMPLICIT_TYPE); | 3723 return hasModifier(Modifier.IMPLICIT_TYPE); |
3712 } | 3724 } |
3713 | 3725 |
3714 /** | 3726 /** |
3715 * Set whether this executable element has an implicit return type. | 3727 * Set whether this executable element has an implicit return type. |
3716 */ | 3728 */ |
3717 void set hasImplicitReturnType(bool hasImplicitReturnType) { | 3729 void set hasImplicitReturnType(bool hasImplicitReturnType) { |
3718 assert(serializedExecutable == null); | 3730 _assertNotResynthesized(serializedExecutable); |
3719 setModifier(Modifier.IMPLICIT_TYPE, hasImplicitReturnType); | 3731 setModifier(Modifier.IMPLICIT_TYPE, hasImplicitReturnType); |
3720 } | 3732 } |
3721 | 3733 |
3722 @override | 3734 @override |
3723 bool get isAbstract { | 3735 bool get isAbstract { |
3724 if (serializedExecutable != null) { | 3736 if (serializedExecutable != null) { |
3725 return serializedExecutable.isAbstract; | 3737 return serializedExecutable.isAbstract; |
3726 } | 3738 } |
3727 return hasModifier(Modifier.ABSTRACT); | 3739 return hasModifier(Modifier.ABSTRACT); |
3728 } | 3740 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3764 this, serializedExecutable.localLabels); | 3776 this, serializedExecutable.localLabels); |
3765 } | 3777 } |
3766 return _labels ?? const <LabelElement>[]; | 3778 return _labels ?? const <LabelElement>[]; |
3767 } | 3779 } |
3768 | 3780 |
3769 /** | 3781 /** |
3770 * Set the labels defined within this executable element to the given | 3782 * Set the labels defined within this executable element to the given |
3771 * [labels]. | 3783 * [labels]. |
3772 */ | 3784 */ |
3773 void set labels(List<LabelElement> labels) { | 3785 void set labels(List<LabelElement> labels) { |
3774 assert(serializedExecutable == null); | 3786 _assertNotResynthesized(serializedExecutable); |
3775 for (LabelElement label in labels) { | 3787 for (LabelElement label in labels) { |
3776 (label as LabelElementImpl).enclosingElement = this; | 3788 (label as LabelElementImpl).enclosingElement = this; |
3777 } | 3789 } |
3778 this._labels = labels; | 3790 this._labels = labels; |
3779 } | 3791 } |
3780 | 3792 |
3781 @override | 3793 @override |
3782 List<LocalVariableElement> get localVariables { | 3794 List<LocalVariableElement> get localVariables { |
3783 if (serializedExecutable != null && _localVariables == null) { | 3795 if (serializedExecutable != null && _localVariables == null) { |
3784 List<UnlinkedVariable> unlinkedVariables = | 3796 List<UnlinkedVariable> unlinkedVariables = |
(...skipping 12 matching lines...) Expand all Loading... |
3797 } | 3809 } |
3798 } | 3810 } |
3799 return _localVariables ?? const <LocalVariableElement>[]; | 3811 return _localVariables ?? const <LocalVariableElement>[]; |
3800 } | 3812 } |
3801 | 3813 |
3802 /** | 3814 /** |
3803 * Set the local variables defined within this executable element to the given | 3815 * Set the local variables defined within this executable element to the given |
3804 * [variables]. | 3816 * [variables]. |
3805 */ | 3817 */ |
3806 void set localVariables(List<LocalVariableElement> variables) { | 3818 void set localVariables(List<LocalVariableElement> variables) { |
3807 assert(serializedExecutable == null); | 3819 _assertNotResynthesized(serializedExecutable); |
3808 for (LocalVariableElement variable in variables) { | 3820 for (LocalVariableElement variable in variables) { |
3809 (variable as LocalVariableElementImpl).enclosingElement = this; | 3821 (variable as LocalVariableElementImpl).enclosingElement = this; |
3810 } | 3822 } |
3811 this._localVariables = variables; | 3823 this._localVariables = variables; |
3812 } | 3824 } |
3813 | 3825 |
3814 @override | 3826 @override |
3815 List<ElementAnnotation> get metadata { | 3827 List<ElementAnnotation> get metadata { |
3816 if (serializedExecutable != null) { | 3828 if (serializedExecutable != null) { |
3817 return _metadata ??= | 3829 return _metadata ??= |
(...skipping 26 matching lines...) Expand all Loading... |
3844 serializedExecutable.parameters, this); | 3856 serializedExecutable.parameters, this); |
3845 } | 3857 } |
3846 return _parameters ?? const <ParameterElement>[]; | 3858 return _parameters ?? const <ParameterElement>[]; |
3847 } | 3859 } |
3848 | 3860 |
3849 /** | 3861 /** |
3850 * Set the parameters defined by this executable element to the given | 3862 * Set the parameters defined by this executable element to the given |
3851 * [parameters]. | 3863 * [parameters]. |
3852 */ | 3864 */ |
3853 void set parameters(List<ParameterElement> parameters) { | 3865 void set parameters(List<ParameterElement> parameters) { |
3854 assert(serializedExecutable == null); | 3866 _assertNotResynthesized(serializedExecutable); |
3855 for (ParameterElement parameter in parameters) { | 3867 for (ParameterElement parameter in parameters) { |
3856 (parameter as ParameterElementImpl).enclosingElement = this; | 3868 (parameter as ParameterElementImpl).enclosingElement = this; |
3857 } | 3869 } |
3858 this._parameters = parameters; | 3870 this._parameters = parameters; |
3859 } | 3871 } |
3860 | 3872 |
3861 @override | 3873 @override |
3862 DartType get returnType { | 3874 DartType get returnType { |
3863 if (serializedExecutable != null && _returnType == null) { | 3875 if (serializedExecutable != null && _returnType == null) { |
3864 bool isSetter = | 3876 bool isSetter = |
3865 serializedExecutable.kind == UnlinkedExecutableKind.setter; | 3877 serializedExecutable.kind == UnlinkedExecutableKind.setter; |
3866 _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 3878 _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( |
3867 serializedExecutable.inferredReturnTypeSlot, | 3879 serializedExecutable.inferredReturnTypeSlot, |
3868 typeParameterContext) ?? | 3880 typeParameterContext) ?? |
3869 enclosingUnit.resynthesizerContext.resolveTypeRef( | 3881 enclosingUnit.resynthesizerContext.resolveTypeRef( |
3870 serializedExecutable.returnType, typeParameterContext, | 3882 serializedExecutable.returnType, typeParameterContext, |
3871 defaultVoid: isSetter && context.analysisOptions.strongMode); | 3883 defaultVoid: isSetter && context.analysisOptions.strongMode); |
3872 } | 3884 } |
3873 return _returnType; | 3885 return _returnType; |
3874 } | 3886 } |
3875 | 3887 |
3876 void set returnType(DartType returnType) { | 3888 void set returnType(DartType returnType) { |
3877 assert(serializedExecutable == null); | 3889 _assertNotResynthesized(serializedExecutable); |
3878 _returnType = returnType; | 3890 _returnType = returnType; |
3879 } | 3891 } |
3880 | 3892 |
3881 @override | 3893 @override |
3882 FunctionType get type { | 3894 FunctionType get type { |
3883 if (serializedExecutable != null) { | 3895 if (serializedExecutable != null) { |
3884 _type ??= new FunctionTypeImpl.elementWithNameAndArgs( | 3896 _type ??= new FunctionTypeImpl.elementWithNameAndArgs( |
3885 this, null, allEnclosingTypeParameterTypes, false); | 3897 this, null, allEnclosingTypeParameterTypes, false); |
3886 } | 3898 } |
3887 return _type; | 3899 return _type; |
3888 } | 3900 } |
3889 | 3901 |
3890 void set type(FunctionType type) { | 3902 void set type(FunctionType type) { |
3891 assert(serializedExecutable == null); | 3903 _assertNotResynthesized(serializedExecutable); |
3892 _type = type; | 3904 _type = type; |
3893 } | 3905 } |
3894 | 3906 |
3895 @override | 3907 @override |
3896 TypeParameterizedElementMixin get typeParameterContext => this; | 3908 TypeParameterizedElementMixin get typeParameterContext => this; |
3897 | 3909 |
3898 @override | 3910 @override |
3899 List<TypeParameterElement> get typeParameters { | 3911 List<TypeParameterElement> get typeParameters { |
3900 if (serializedExecutable != null) { | 3912 if (serializedExecutable != null) { |
3901 return super.typeParameters; | 3913 return super.typeParameters; |
3902 } | 3914 } |
3903 return _typeParameters ?? const <TypeParameterElement>[]; | 3915 return _typeParameters ?? const <TypeParameterElement>[]; |
3904 } | 3916 } |
3905 | 3917 |
3906 /** | 3918 /** |
3907 * Set the type parameters defined by this executable element to the given | 3919 * Set the type parameters defined by this executable element to the given |
3908 * [typeParameters]. | 3920 * [typeParameters]. |
3909 */ | 3921 */ |
3910 void set typeParameters(List<TypeParameterElement> typeParameters) { | 3922 void set typeParameters(List<TypeParameterElement> typeParameters) { |
3911 assert(serializedExecutable == null); | 3923 _assertNotResynthesized(serializedExecutable); |
3912 for (TypeParameterElement parameter in typeParameters) { | 3924 for (TypeParameterElement parameter in typeParameters) { |
3913 (parameter as TypeParameterElementImpl).enclosingElement = this; | 3925 (parameter as TypeParameterElementImpl).enclosingElement = this; |
3914 } | 3926 } |
3915 this._typeParameters = typeParameters; | 3927 this._typeParameters = typeParameters; |
3916 } | 3928 } |
3917 | 3929 |
3918 @override | 3930 @override |
3919 List<UnlinkedTypeParam> get unlinkedTypeParams => | 3931 List<UnlinkedTypeParam> get unlinkedTypeParams => |
3920 serializedExecutable.typeParameters; | 3932 serializedExecutable.typeParameters; |
3921 | 3933 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 @override | 4072 @override |
4061 List<NamespaceCombinator> get combinators { | 4073 List<NamespaceCombinator> get combinators { |
4062 if (_unlinkedExportPublic != null && _combinators == null) { | 4074 if (_unlinkedExportPublic != null && _combinators == null) { |
4063 _combinators = ImportElementImpl | 4075 _combinators = ImportElementImpl |
4064 ._buildCombinators(_unlinkedExportPublic.combinators); | 4076 ._buildCombinators(_unlinkedExportPublic.combinators); |
4065 } | 4077 } |
4066 return _combinators ?? const <NamespaceCombinator>[]; | 4078 return _combinators ?? const <NamespaceCombinator>[]; |
4067 } | 4079 } |
4068 | 4080 |
4069 void set combinators(List<NamespaceCombinator> combinators) { | 4081 void set combinators(List<NamespaceCombinator> combinators) { |
4070 assert(_unlinkedExportPublic == null); | 4082 _assertNotResynthesized(_unlinkedExportPublic); |
4071 _combinators = combinators; | 4083 _combinators = combinators; |
4072 } | 4084 } |
4073 | 4085 |
4074 @override | 4086 @override |
4075 LibraryElement get exportedLibrary { | 4087 LibraryElement get exportedLibrary { |
4076 if (_unlinkedExportNonPublic != null && _exportedLibrary == null) { | 4088 if (_unlinkedExportNonPublic != null && _exportedLibrary == null) { |
4077 LibraryElementImpl library = enclosingElement as LibraryElementImpl; | 4089 LibraryElementImpl library = enclosingElement as LibraryElementImpl; |
4078 _exportedLibrary = library.resynthesizerContext.buildExportedLibrary(uri); | 4090 _exportedLibrary = library.resynthesizerContext.buildExportedLibrary(uri); |
4079 } | 4091 } |
4080 return _exportedLibrary; | 4092 return _exportedLibrary; |
4081 } | 4093 } |
4082 | 4094 |
4083 void set exportedLibrary(LibraryElement exportedLibrary) { | 4095 void set exportedLibrary(LibraryElement exportedLibrary) { |
4084 assert(_unlinkedExportNonPublic == null); | 4096 _assertNotResynthesized(_unlinkedExportNonPublic); |
4085 _exportedLibrary = exportedLibrary; | 4097 _exportedLibrary = exportedLibrary; |
4086 } | 4098 } |
4087 | 4099 |
4088 @override | 4100 @override |
4089 String get identifier => exportedLibrary.name; | 4101 String get identifier => exportedLibrary.name; |
4090 | 4102 |
4091 @override | 4103 @override |
4092 ElementKind get kind => ElementKind.EXPORT; | 4104 ElementKind get kind => ElementKind.EXPORT; |
4093 | 4105 |
4094 @override | 4106 @override |
4095 List<ElementAnnotation> get metadata { | 4107 List<ElementAnnotation> get metadata { |
4096 if (_unlinkedExportNonPublic != null) { | 4108 if (_unlinkedExportNonPublic != null) { |
4097 return _metadata ??= _buildAnnotations( | 4109 return _metadata ??= _buildAnnotations( |
4098 library.definingCompilationUnit as CompilationUnitElementImpl, | 4110 library.definingCompilationUnit as CompilationUnitElementImpl, |
4099 _unlinkedExportNonPublic.annotations); | 4111 _unlinkedExportNonPublic.annotations); |
4100 } | 4112 } |
4101 return super.metadata; | 4113 return super.metadata; |
4102 } | 4114 } |
4103 | 4115 |
4104 void set metadata(List<ElementAnnotation> metadata) { | 4116 void set metadata(List<ElementAnnotation> metadata) { |
4105 assert(_unlinkedExportNonPublic == null); | 4117 _assertNotResynthesized(_unlinkedExportNonPublic); |
4106 super.metadata = metadata; | 4118 super.metadata = metadata; |
4107 } | 4119 } |
4108 | 4120 |
4109 @override | 4121 @override |
4110 int get nameOffset { | 4122 int get nameOffset { |
4111 int offset = super.nameOffset; | 4123 int offset = super.nameOffset; |
4112 if (offset == 0 && _unlinkedExportNonPublic != null) { | 4124 if (offset == 0 && _unlinkedExportNonPublic != null) { |
4113 return _unlinkedExportNonPublic.offset; | 4125 return _unlinkedExportNonPublic.offset; |
4114 } | 4126 } |
4115 return offset; | 4127 return offset; |
4116 } | 4128 } |
4117 | 4129 |
4118 @override | 4130 @override |
4119 String get uri { | 4131 String get uri { |
4120 if (_unlinkedExportPublic != null) { | 4132 if (_unlinkedExportPublic != null) { |
4121 return _selectedUri ??= _selectUri( | 4133 return _selectedUri ??= _selectUri( |
4122 _unlinkedExportPublic.uri, _unlinkedExportPublic.configurations); | 4134 _unlinkedExportPublic.uri, _unlinkedExportPublic.configurations); |
4123 } | 4135 } |
4124 return super.uri; | 4136 return super.uri; |
4125 } | 4137 } |
4126 | 4138 |
4127 @override | 4139 @override |
4128 void set uri(String uri) { | 4140 void set uri(String uri) { |
4129 assert(_unlinkedExportPublic == null); | 4141 _assertNotResynthesized(_unlinkedExportPublic); |
4130 super.uri = uri; | 4142 super.uri = uri; |
4131 } | 4143 } |
4132 | 4144 |
4133 @override | 4145 @override |
4134 int get uriEnd { | 4146 int get uriEnd { |
4135 if (_unlinkedExportNonPublic != null) { | 4147 if (_unlinkedExportNonPublic != null) { |
4136 return _unlinkedExportNonPublic.uriEnd; | 4148 return _unlinkedExportNonPublic.uriEnd; |
4137 } | 4149 } |
4138 return super.uriEnd; | 4150 return super.uriEnd; |
4139 } | 4151 } |
4140 | 4152 |
4141 @override | 4153 @override |
4142 void set uriEnd(int uriEnd) { | 4154 void set uriEnd(int uriEnd) { |
4143 assert(_unlinkedExportNonPublic == null); | 4155 _assertNotResynthesized(_unlinkedExportNonPublic); |
4144 super.uriEnd = uriEnd; | 4156 super.uriEnd = uriEnd; |
4145 } | 4157 } |
4146 | 4158 |
4147 @override | 4159 @override |
4148 int get uriOffset { | 4160 int get uriOffset { |
4149 if (_unlinkedExportNonPublic != null) { | 4161 if (_unlinkedExportNonPublic != null) { |
4150 return _unlinkedExportNonPublic.uriOffset; | 4162 return _unlinkedExportNonPublic.uriOffset; |
4151 } | 4163 } |
4152 return super.uriOffset; | 4164 return super.uriOffset; |
4153 } | 4165 } |
4154 | 4166 |
4155 @override | 4167 @override |
4156 void set uriOffset(int uriOffset) { | 4168 void set uriOffset(int uriOffset) { |
4157 assert(_unlinkedExportNonPublic == null); | 4169 _assertNotResynthesized(_unlinkedExportNonPublic); |
4158 super.uriOffset = uriOffset; | 4170 super.uriOffset = uriOffset; |
4159 } | 4171 } |
4160 | 4172 |
4161 @override | 4173 @override |
4162 accept(ElementVisitor visitor) => visitor.visitExportElement(this); | 4174 accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
4163 | 4175 |
4164 @override | 4176 @override |
4165 void appendTo(StringBuffer buffer) { | 4177 void appendTo(StringBuffer buffer) { |
4166 buffer.write("export "); | 4178 buffer.write("export "); |
4167 (exportedLibrary as LibraryElementImpl).appendTo(buffer); | 4179 (exportedLibrary as LibraryElementImpl).appendTo(buffer); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4232 return false; | 4244 return false; |
4233 } | 4245 } |
4234 | 4246 |
4235 @override | 4247 @override |
4236 ElementKind get kind => ElementKind.FIELD; | 4248 ElementKind get kind => ElementKind.FIELD; |
4237 | 4249 |
4238 /** | 4250 /** |
4239 * Set whether this field is static. | 4251 * Set whether this field is static. |
4240 */ | 4252 */ |
4241 void set static(bool isStatic) { | 4253 void set static(bool isStatic) { |
4242 assert(_unlinkedVariable == null); | 4254 _assertNotResynthesized(_unlinkedVariable); |
4243 setModifier(Modifier.STATIC, isStatic); | 4255 setModifier(Modifier.STATIC, isStatic); |
4244 } | 4256 } |
4245 | 4257 |
4246 @override | 4258 @override |
4247 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 4259 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
4248 | 4260 |
4249 @override | 4261 @override |
4250 AstNode computeNode() { | 4262 AstNode computeNode() { |
4251 if (isEnumConstant) { | 4263 if (isEnumConstant) { |
4252 return getNodeMatching((node) => node is EnumConstantDeclaration); | 4264 return getNodeMatching((node) => node is EnumConstantDeclaration); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 if (_unlinkedParam != null && _field == null) { | 4304 if (_unlinkedParam != null && _field == null) { |
4293 Element enclosingClass = enclosingElement?.enclosingElement; | 4305 Element enclosingClass = enclosingElement?.enclosingElement; |
4294 if (enclosingClass is ClassElement) { | 4306 if (enclosingClass is ClassElement) { |
4295 _field = enclosingClass.getField(_unlinkedParam.name); | 4307 _field = enclosingClass.getField(_unlinkedParam.name); |
4296 } | 4308 } |
4297 } | 4309 } |
4298 return _field; | 4310 return _field; |
4299 } | 4311 } |
4300 | 4312 |
4301 void set field(FieldElement field) { | 4313 void set field(FieldElement field) { |
4302 assert(_unlinkedParam == null); | 4314 _assertNotResynthesized(_unlinkedParam); |
4303 _field = field; | 4315 _field = field; |
4304 } | 4316 } |
4305 | 4317 |
4306 @override | 4318 @override |
4307 bool get isInitializingFormal => true; | 4319 bool get isInitializingFormal => true; |
4308 | 4320 |
4309 @override | 4321 @override |
4310 DartType get type { | 4322 DartType get type { |
4311 if (_unlinkedParam != null && _unlinkedParam.type == null) { | 4323 if (_unlinkedParam != null && _unlinkedParam.type == null) { |
4312 _type ??= field?.type ?? DynamicTypeImpl.instance; | 4324 _type ??= field?.type ?? DynamicTypeImpl.instance; |
4313 } | 4325 } |
4314 return super.type; | 4326 return super.type; |
4315 } | 4327 } |
4316 | 4328 |
4317 @override | 4329 @override |
4318 void set type(DartType type) { | 4330 void set type(DartType type) { |
4319 assert(_unlinkedParam == null); | 4331 _assertNotResynthesized(_unlinkedParam); |
4320 _type = type; | 4332 _type = type; |
4321 } | 4333 } |
4322 | 4334 |
4323 @override | 4335 @override |
4324 accept(ElementVisitor visitor) => | 4336 accept(ElementVisitor visitor) => |
4325 visitor.visitFieldFormalParameterElement(this); | 4337 visitor.visitFieldFormalParameterElement(this); |
4326 } | 4338 } |
4327 | 4339 |
4328 /** | 4340 /** |
4329 * A concrete implementation of a [FunctionElement]. | 4341 * A concrete implementation of a [FunctionElement]. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4436 | 4448 |
4437 @override | 4449 @override |
4438 FunctionDeclaration computeNode() => | 4450 FunctionDeclaration computeNode() => |
4439 getNodeMatching((node) => node is FunctionDeclaration); | 4451 getNodeMatching((node) => node is FunctionDeclaration); |
4440 | 4452 |
4441 /** | 4453 /** |
4442 * Set the visible range for this element to the range starting at the given | 4454 * Set the visible range for this element to the range starting at the given |
4443 * [offset] with the given [length]. | 4455 * [offset] with the given [length]. |
4444 */ | 4456 */ |
4445 void setVisibleRange(int offset, int length) { | 4457 void setVisibleRange(int offset, int length) { |
4446 assert(serializedExecutable == null); | 4458 _assertNotResynthesized(serializedExecutable); |
4447 _visibleRangeOffset = offset; | 4459 _visibleRangeOffset = offset; |
4448 _visibleRangeLength = length; | 4460 _visibleRangeLength = length; |
4449 } | 4461 } |
4450 | 4462 |
4451 /** | 4463 /** |
4452 * Set the parameters defined by this type alias to the given [parameters] | 4464 * Set the parameters defined by this type alias to the given [parameters] |
4453 * without becoming the parent of the parameters. This should only be used by | 4465 * without becoming the parent of the parameters. This should only be used by |
4454 * the [TypeResolverVisitor] when creating a synthetic type alias. | 4466 * the [TypeResolverVisitor] when creating a synthetic type alias. |
4455 */ | 4467 */ |
4456 void shareParameters(List<ParameterElement> parameters) { | 4468 void shareParameters(List<ParameterElement> parameters) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4695 _parameters ??= ParameterElementImpl.resynthesizeList( | 4707 _parameters ??= ParameterElementImpl.resynthesizeList( |
4696 _unlinkedTypedef.parameters, this); | 4708 _unlinkedTypedef.parameters, this); |
4697 } | 4709 } |
4698 return _parameters ?? const <ParameterElement>[]; | 4710 return _parameters ?? const <ParameterElement>[]; |
4699 } | 4711 } |
4700 | 4712 |
4701 /** | 4713 /** |
4702 * Set the parameters defined by this type alias to the given [parameters]. | 4714 * Set the parameters defined by this type alias to the given [parameters]. |
4703 */ | 4715 */ |
4704 void set parameters(List<ParameterElement> parameters) { | 4716 void set parameters(List<ParameterElement> parameters) { |
4705 assert(_unlinkedTypedef == null); | 4717 _assertNotResynthesized(_unlinkedTypedef); |
4706 if (parameters != null) { | 4718 if (parameters != null) { |
4707 for (ParameterElement parameter in parameters) { | 4719 for (ParameterElement parameter in parameters) { |
4708 (parameter as ParameterElementImpl).enclosingElement = this; | 4720 (parameter as ParameterElementImpl).enclosingElement = this; |
4709 } | 4721 } |
4710 } | 4722 } |
4711 this._parameters = parameters; | 4723 this._parameters = parameters; |
4712 } | 4724 } |
4713 | 4725 |
4714 @override | 4726 @override |
4715 DartType get returnType { | 4727 DartType get returnType { |
4716 if (_unlinkedTypedef != null && _returnType == null) { | 4728 if (_unlinkedTypedef != null && _returnType == null) { |
4717 _returnType = enclosingUnit.resynthesizerContext | 4729 _returnType = enclosingUnit.resynthesizerContext |
4718 .resolveTypeRef(_unlinkedTypedef.returnType, this); | 4730 .resolveTypeRef(_unlinkedTypedef.returnType, this); |
4719 } | 4731 } |
4720 return _returnType; | 4732 return _returnType; |
4721 } | 4733 } |
4722 | 4734 |
4723 void set returnType(DartType returnType) { | 4735 void set returnType(DartType returnType) { |
4724 assert(_unlinkedTypedef == null); | 4736 _assertNotResynthesized(_unlinkedTypedef); |
4725 _returnType = returnType; | 4737 _returnType = returnType; |
4726 } | 4738 } |
4727 | 4739 |
4728 @override | 4740 @override |
4729 FunctionType get type { | 4741 FunctionType get type { |
4730 if (_unlinkedTypedef != null && _type == null) { | 4742 if (_unlinkedTypedef != null && _type == null) { |
4731 _type = new FunctionTypeImpl.forTypedef(this); | 4743 _type = new FunctionTypeImpl.forTypedef(this); |
4732 } | 4744 } |
4733 return _type; | 4745 return _type; |
4734 } | 4746 } |
4735 | 4747 |
4736 void set type(FunctionType type) { | 4748 void set type(FunctionType type) { |
4737 assert(_unlinkedTypedef == null); | 4749 _assertNotResynthesized(_unlinkedTypedef); |
4738 _type = type; | 4750 _type = type; |
4739 } | 4751 } |
4740 | 4752 |
4741 @override | 4753 @override |
4742 TypeParameterizedElementMixin get typeParameterContext => this; | 4754 TypeParameterizedElementMixin get typeParameterContext => this; |
4743 | 4755 |
4744 @override | 4756 @override |
4745 List<TypeParameterElement> get typeParameters { | 4757 List<TypeParameterElement> get typeParameters { |
4746 if (_unlinkedTypedef != null) { | 4758 if (_unlinkedTypedef != null) { |
4747 return super.typeParameters; | 4759 return super.typeParameters; |
4748 } | 4760 } |
4749 return _typeParameters; | 4761 return _typeParameters; |
4750 } | 4762 } |
4751 | 4763 |
4752 /** | 4764 /** |
4753 * Set the type parameters defined for this type to the given | 4765 * Set the type parameters defined for this type to the given |
4754 * [typeParameters]. | 4766 * [typeParameters]. |
4755 */ | 4767 */ |
4756 void set typeParameters(List<TypeParameterElement> typeParameters) { | 4768 void set typeParameters(List<TypeParameterElement> typeParameters) { |
4757 assert(_unlinkedTypedef == null); | 4769 _assertNotResynthesized(_unlinkedTypedef); |
4758 for (TypeParameterElement typeParameter in typeParameters) { | 4770 for (TypeParameterElement typeParameter in typeParameters) { |
4759 (typeParameter as TypeParameterElementImpl).enclosingElement = this; | 4771 (typeParameter as TypeParameterElementImpl).enclosingElement = this; |
4760 } | 4772 } |
4761 this._typeParameters = typeParameters; | 4773 this._typeParameters = typeParameters; |
4762 } | 4774 } |
4763 | 4775 |
4764 @override | 4776 @override |
4765 List<UnlinkedTypeParam> get unlinkedTypeParams => | 4777 List<UnlinkedTypeParam> get unlinkedTypeParams => |
4766 _unlinkedTypedef.typeParameters; | 4778 _unlinkedTypedef.typeParameters; |
4767 | 4779 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4854 | 4866 |
4855 @override | 4867 @override |
4856 List<String> get hiddenNames { | 4868 List<String> get hiddenNames { |
4857 if (_unlinkedCombinator != null) { | 4869 if (_unlinkedCombinator != null) { |
4858 _hiddenNames ??= _unlinkedCombinator.hides.toList(growable: false); | 4870 _hiddenNames ??= _unlinkedCombinator.hides.toList(growable: false); |
4859 } | 4871 } |
4860 return _hiddenNames ?? const <String>[]; | 4872 return _hiddenNames ?? const <String>[]; |
4861 } | 4873 } |
4862 | 4874 |
4863 void set hiddenNames(List<String> hiddenNames) { | 4875 void set hiddenNames(List<String> hiddenNames) { |
4864 assert(_unlinkedCombinator == null); | 4876 _assertNotResynthesized(_unlinkedCombinator); |
4865 _hiddenNames = hiddenNames; | 4877 _hiddenNames = hiddenNames; |
4866 } | 4878 } |
4867 | 4879 |
4868 @override | 4880 @override |
4869 String toString() { | 4881 String toString() { |
4870 StringBuffer buffer = new StringBuffer(); | 4882 StringBuffer buffer = new StringBuffer(); |
4871 buffer.write("show "); | 4883 buffer.write("show "); |
4872 int count = hiddenNames.length; | 4884 int count = hiddenNames.length; |
4873 for (int i = 0; i < count; i++) { | 4885 for (int i = 0; i < count; i++) { |
4874 if (i > 0) { | 4886 if (i > 0) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4941 | 4953 |
4942 @override | 4954 @override |
4943 List<NamespaceCombinator> get combinators { | 4955 List<NamespaceCombinator> get combinators { |
4944 if (_unlinkedImport != null && _combinators == null) { | 4956 if (_unlinkedImport != null && _combinators == null) { |
4945 _combinators = _buildCombinators(_unlinkedImport.combinators); | 4957 _combinators = _buildCombinators(_unlinkedImport.combinators); |
4946 } | 4958 } |
4947 return _combinators ?? const <NamespaceCombinator>[]; | 4959 return _combinators ?? const <NamespaceCombinator>[]; |
4948 } | 4960 } |
4949 | 4961 |
4950 void set combinators(List<NamespaceCombinator> combinators) { | 4962 void set combinators(List<NamespaceCombinator> combinators) { |
4951 assert(_unlinkedImport == null); | 4963 _assertNotResynthesized(_unlinkedImport); |
4952 _combinators = combinators; | 4964 _combinators = combinators; |
4953 } | 4965 } |
4954 | 4966 |
4955 /** | 4967 /** |
4956 * Set whether this import is for a deferred library. | 4968 * Set whether this import is for a deferred library. |
4957 */ | 4969 */ |
4958 void set deferred(bool isDeferred) { | 4970 void set deferred(bool isDeferred) { |
4959 assert(_unlinkedImport == null); | 4971 _assertNotResynthesized(_unlinkedImport); |
4960 setModifier(Modifier.DEFERRED, isDeferred); | 4972 setModifier(Modifier.DEFERRED, isDeferred); |
4961 } | 4973 } |
4962 | 4974 |
4963 @override | 4975 @override |
4964 String get identifier => "${importedLibrary.identifier}@$nameOffset"; | 4976 String get identifier => "${importedLibrary.identifier}@$nameOffset"; |
4965 | 4977 |
4966 @override | 4978 @override |
4967 LibraryElement get importedLibrary { | 4979 LibraryElement get importedLibrary { |
4968 if (_linkedDependency != null) { | 4980 if (_linkedDependency != null) { |
4969 if (_importedLibrary == null) { | 4981 if (_importedLibrary == null) { |
4970 LibraryElementImpl library = enclosingElement as LibraryElementImpl; | 4982 LibraryElementImpl library = enclosingElement as LibraryElementImpl; |
4971 if (_linkedDependency == 0) { | 4983 if (_linkedDependency == 0) { |
4972 _importedLibrary = library; | 4984 _importedLibrary = library; |
4973 } else { | 4985 } else { |
4974 _importedLibrary = library.resynthesizerContext | 4986 _importedLibrary = library.resynthesizerContext |
4975 .buildImportedLibrary(_linkedDependency); | 4987 .buildImportedLibrary(_linkedDependency); |
4976 } | 4988 } |
4977 } | 4989 } |
4978 } | 4990 } |
4979 return _importedLibrary; | 4991 return _importedLibrary; |
4980 } | 4992 } |
4981 | 4993 |
4982 void set importedLibrary(LibraryElement importedLibrary) { | 4994 void set importedLibrary(LibraryElement importedLibrary) { |
4983 assert(_unlinkedImport == null); | 4995 _assertNotResynthesized(_unlinkedImport); |
4984 _importedLibrary = importedLibrary; | 4996 _importedLibrary = importedLibrary; |
4985 } | 4997 } |
4986 | 4998 |
4987 @override | 4999 @override |
4988 bool get isDeferred { | 5000 bool get isDeferred { |
4989 if (_unlinkedImport != null) { | 5001 if (_unlinkedImport != null) { |
4990 return _unlinkedImport.isDeferred; | 5002 return _unlinkedImport.isDeferred; |
4991 } | 5003 } |
4992 return hasModifier(Modifier.DEFERRED); | 5004 return hasModifier(Modifier.DEFERRED); |
4993 } | 5005 } |
(...skipping 13 matching lines...) Expand all Loading... |
5007 List<ElementAnnotation> get metadata { | 5019 List<ElementAnnotation> get metadata { |
5008 if (_unlinkedImport != null) { | 5020 if (_unlinkedImport != null) { |
5009 return _metadata ??= _buildAnnotations( | 5021 return _metadata ??= _buildAnnotations( |
5010 library.definingCompilationUnit as CompilationUnitElementImpl, | 5022 library.definingCompilationUnit as CompilationUnitElementImpl, |
5011 _unlinkedImport.annotations); | 5023 _unlinkedImport.annotations); |
5012 } | 5024 } |
5013 return super.metadata; | 5025 return super.metadata; |
5014 } | 5026 } |
5015 | 5027 |
5016 void set metadata(List<ElementAnnotation> metadata) { | 5028 void set metadata(List<ElementAnnotation> metadata) { |
5017 assert(_unlinkedImport == null); | 5029 _assertNotResynthesized(_unlinkedImport); |
5018 super.metadata = metadata; | 5030 super.metadata = metadata; |
5019 } | 5031 } |
5020 | 5032 |
5021 @override | 5033 @override |
5022 int get nameOffset { | 5034 int get nameOffset { |
5023 int offset = super.nameOffset; | 5035 int offset = super.nameOffset; |
5024 if (offset == 0 && _unlinkedImport != null) { | 5036 if (offset == 0 && _unlinkedImport != null) { |
5025 if (_unlinkedImport.isImplicit) { | 5037 if (_unlinkedImport.isImplicit) { |
5026 return -1; | 5038 return -1; |
5027 } | 5039 } |
5028 return _unlinkedImport.offset; | 5040 return _unlinkedImport.offset; |
5029 } | 5041 } |
5030 return offset; | 5042 return offset; |
5031 } | 5043 } |
5032 | 5044 |
5033 PrefixElement get prefix { | 5045 PrefixElement get prefix { |
5034 if (_unlinkedImport != null) { | 5046 if (_unlinkedImport != null) { |
5035 if (_unlinkedImport.prefixReference != 0 && _prefix == null) { | 5047 if (_unlinkedImport.prefixReference != 0 && _prefix == null) { |
5036 LibraryElementImpl library = enclosingElement as LibraryElementImpl; | 5048 LibraryElementImpl library = enclosingElement as LibraryElementImpl; |
5037 _prefix = new PrefixElementImpl.forSerialized(_unlinkedImport, library); | 5049 _prefix = new PrefixElementImpl.forSerialized(_unlinkedImport, library); |
5038 } | 5050 } |
5039 } | 5051 } |
5040 return _prefix; | 5052 return _prefix; |
5041 } | 5053 } |
5042 | 5054 |
5043 void set prefix(PrefixElement prefix) { | 5055 void set prefix(PrefixElement prefix) { |
5044 assert(_unlinkedImport == null); | 5056 _assertNotResynthesized(_unlinkedImport); |
5045 _prefix = prefix; | 5057 _prefix = prefix; |
5046 } | 5058 } |
5047 | 5059 |
5048 @override | 5060 @override |
5049 int get prefixOffset { | 5061 int get prefixOffset { |
5050 if (_unlinkedImport != null) { | 5062 if (_unlinkedImport != null) { |
5051 return _unlinkedImport.prefixOffset; | 5063 return _unlinkedImport.prefixOffset; |
5052 } | 5064 } |
5053 return _prefixOffset; | 5065 return _prefixOffset; |
5054 } | 5066 } |
5055 | 5067 |
5056 void set prefixOffset(int prefixOffset) { | 5068 void set prefixOffset(int prefixOffset) { |
5057 assert(_unlinkedImport == null); | 5069 _assertNotResynthesized(_unlinkedImport); |
5058 _prefixOffset = prefixOffset; | 5070 _prefixOffset = prefixOffset; |
5059 } | 5071 } |
5060 | 5072 |
5061 @override | 5073 @override |
5062 String get uri { | 5074 String get uri { |
5063 if (_unlinkedImport != null) { | 5075 if (_unlinkedImport != null) { |
5064 if (_unlinkedImport.isImplicit) { | 5076 if (_unlinkedImport.isImplicit) { |
5065 return null; | 5077 return null; |
5066 } | 5078 } |
5067 return _selectedUri ??= | 5079 return _selectedUri ??= |
5068 _selectUri(_unlinkedImport.uri, _unlinkedImport.configurations); | 5080 _selectUri(_unlinkedImport.uri, _unlinkedImport.configurations); |
5069 } | 5081 } |
5070 return super.uri; | 5082 return super.uri; |
5071 } | 5083 } |
5072 | 5084 |
5073 @override | 5085 @override |
5074 void set uri(String uri) { | 5086 void set uri(String uri) { |
5075 assert(_unlinkedImport == null); | 5087 _assertNotResynthesized(_unlinkedImport); |
5076 super.uri = uri; | 5088 super.uri = uri; |
5077 } | 5089 } |
5078 | 5090 |
5079 @override | 5091 @override |
5080 int get uriEnd { | 5092 int get uriEnd { |
5081 if (_unlinkedImport != null) { | 5093 if (_unlinkedImport != null) { |
5082 if (_unlinkedImport.isImplicit) { | 5094 if (_unlinkedImport.isImplicit) { |
5083 return -1; | 5095 return -1; |
5084 } | 5096 } |
5085 return _unlinkedImport.uriEnd; | 5097 return _unlinkedImport.uriEnd; |
5086 } | 5098 } |
5087 return super.uriEnd; | 5099 return super.uriEnd; |
5088 } | 5100 } |
5089 | 5101 |
5090 @override | 5102 @override |
5091 void set uriEnd(int uriEnd) { | 5103 void set uriEnd(int uriEnd) { |
5092 assert(_unlinkedImport == null); | 5104 _assertNotResynthesized(_unlinkedImport); |
5093 super.uriEnd = uriEnd; | 5105 super.uriEnd = uriEnd; |
5094 } | 5106 } |
5095 | 5107 |
5096 @override | 5108 @override |
5097 int get uriOffset { | 5109 int get uriOffset { |
5098 if (_unlinkedImport != null) { | 5110 if (_unlinkedImport != null) { |
5099 if (_unlinkedImport.isImplicit) { | 5111 if (_unlinkedImport.isImplicit) { |
5100 return -1; | 5112 return -1; |
5101 } | 5113 } |
5102 return _unlinkedImport.uriOffset; | 5114 return _unlinkedImport.uriOffset; |
5103 } | 5115 } |
5104 return super.uriOffset; | 5116 return super.uriOffset; |
5105 } | 5117 } |
5106 | 5118 |
5107 @override | 5119 @override |
5108 void set uriOffset(int uriOffset) { | 5120 void set uriOffset(int uriOffset) { |
5109 assert(_unlinkedImport == null); | 5121 _assertNotResynthesized(_unlinkedImport); |
5110 super.uriOffset = uriOffset; | 5122 super.uriOffset = uriOffset; |
5111 } | 5123 } |
5112 | 5124 |
5113 @override | 5125 @override |
5114 accept(ElementVisitor visitor) => visitor.visitImportElement(this); | 5126 accept(ElementVisitor visitor) => visitor.visitImportElement(this); |
5115 | 5127 |
5116 @override | 5128 @override |
5117 void appendTo(StringBuffer buffer) { | 5129 void appendTo(StringBuffer buffer) { |
5118 buffer.write("import "); | 5130 buffer.write("import "); |
5119 (importedLibrary as LibraryElementImpl).appendTo(buffer); | 5131 (importedLibrary as LibraryElementImpl).appendTo(buffer); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5478 } | 5490 } |
5479 } | 5491 } |
5480 return _exports ?? const <ExportElement>[]; | 5492 return _exports ?? const <ExportElement>[]; |
5481 } | 5493 } |
5482 | 5494 |
5483 /** | 5495 /** |
5484 * Set the specifications of all of the exports defined in this library to the | 5496 * Set the specifications of all of the exports defined in this library to the |
5485 * given list of [exports]. | 5497 * given list of [exports]. |
5486 */ | 5498 */ |
5487 void set exports(List<ExportElement> exports) { | 5499 void set exports(List<ExportElement> exports) { |
5488 assert(_unlinkedDefiningUnit == null); | 5500 _assertNotResynthesized(_unlinkedDefiningUnit); |
5489 for (ExportElement exportElement in exports) { | 5501 for (ExportElement exportElement in exports) { |
5490 (exportElement as ExportElementImpl).enclosingElement = this; | 5502 (exportElement as ExportElementImpl).enclosingElement = this; |
5491 } | 5503 } |
5492 this._exports = exports; | 5504 this._exports = exports; |
5493 } | 5505 } |
5494 | 5506 |
5495 @override | 5507 @override |
5496 bool get hasExtUri => hasModifier(Modifier.HAS_EXT_URI); | 5508 bool get hasExtUri => hasModifier(Modifier.HAS_EXT_URI); |
5497 | 5509 |
5498 /** | 5510 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5548 } | 5560 } |
5549 } | 5561 } |
5550 return _imports ?? ImportElement.EMPTY_LIST; | 5562 return _imports ?? ImportElement.EMPTY_LIST; |
5551 } | 5563 } |
5552 | 5564 |
5553 /** | 5565 /** |
5554 * Set the specifications of all of the imports defined in this library to the | 5566 * Set the specifications of all of the imports defined in this library to the |
5555 * given list of [imports]. | 5567 * given list of [imports]. |
5556 */ | 5568 */ |
5557 void set imports(List<ImportElement> imports) { | 5569 void set imports(List<ImportElement> imports) { |
5558 assert(_unlinkedDefiningUnit == null); | 5570 _assertNotResynthesized(_unlinkedDefiningUnit); |
5559 for (ImportElement importElement in imports) { | 5571 for (ImportElement importElement in imports) { |
5560 (importElement as ImportElementImpl).enclosingElement = this; | 5572 (importElement as ImportElementImpl).enclosingElement = this; |
5561 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; | 5573 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; |
5562 if (prefix != null) { | 5574 if (prefix != null) { |
5563 prefix.enclosingElement = this; | 5575 prefix.enclosingElement = this; |
5564 } | 5576 } |
5565 } | 5577 } |
5566 this._imports = imports; | 5578 this._imports = imports; |
5567 this._prefixes = null; | 5579 this._prefixes = null; |
5568 } | 5580 } |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6078 | 6090 |
6079 @override | 6091 @override |
6080 Declaration computeNode() => getNodeMatching( | 6092 Declaration computeNode() => getNodeMatching( |
6081 (node) => node is DeclaredIdentifier || node is VariableDeclaration); | 6093 (node) => node is DeclaredIdentifier || node is VariableDeclaration); |
6082 | 6094 |
6083 /** | 6095 /** |
6084 * Set the visible range for this element to the range starting at the given | 6096 * Set the visible range for this element to the range starting at the given |
6085 * [offset] with the given [length]. | 6097 * [offset] with the given [length]. |
6086 */ | 6098 */ |
6087 void setVisibleRange(int offset, int length) { | 6099 void setVisibleRange(int offset, int length) { |
6088 assert(_unlinkedVariable == null); | 6100 _assertNotResynthesized(_unlinkedVariable); |
6089 _visibleRangeOffset = offset; | 6101 _visibleRangeOffset = offset; |
6090 _visibleRangeLength = length; | 6102 _visibleRangeLength = length; |
6091 } | 6103 } |
6092 } | 6104 } |
6093 | 6105 |
6094 /** | 6106 /** |
6095 * A concrete implementation of a [MethodElement]. | 6107 * A concrete implementation of a [MethodElement]. |
6096 */ | 6108 */ |
6097 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { | 6109 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { |
6098 /** | 6110 /** |
(...skipping 11 matching lines...) Expand all Loading... |
6110 * Initialize using the given serialized information. | 6122 * Initialize using the given serialized information. |
6111 */ | 6123 */ |
6112 MethodElementImpl.forSerialized( | 6124 MethodElementImpl.forSerialized( |
6113 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass) | 6125 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass) |
6114 : super.forSerialized(serializedExecutable, enclosingClass); | 6126 : super.forSerialized(serializedExecutable, enclosingClass); |
6115 | 6127 |
6116 /** | 6128 /** |
6117 * Set whether this method is abstract. | 6129 * Set whether this method is abstract. |
6118 */ | 6130 */ |
6119 void set abstract(bool isAbstract) { | 6131 void set abstract(bool isAbstract) { |
6120 assert(serializedExecutable == null); | 6132 _assertNotResynthesized(serializedExecutable); |
6121 setModifier(Modifier.ABSTRACT, isAbstract); | 6133 setModifier(Modifier.ABSTRACT, isAbstract); |
6122 } | 6134 } |
6123 | 6135 |
6124 @override | 6136 @override |
6125 List<TypeParameterType> get allEnclosingTypeParameterTypes { | 6137 List<TypeParameterType> get allEnclosingTypeParameterTypes { |
6126 if (isStatic) { | 6138 if (isStatic) { |
6127 return const <TypeParameterType>[]; | 6139 return const <TypeParameterType>[]; |
6128 } | 6140 } |
6129 return super.allEnclosingTypeParameterTypes; | 6141 return super.allEnclosingTypeParameterTypes; |
6130 } | 6142 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6175 if (name == '-' && parameters.isEmpty) { | 6187 if (name == '-' && parameters.isEmpty) { |
6176 return 'unary-'; | 6188 return 'unary-'; |
6177 } | 6189 } |
6178 return super.name; | 6190 return super.name; |
6179 } | 6191 } |
6180 | 6192 |
6181 /** | 6193 /** |
6182 * Set whether this method is static. | 6194 * Set whether this method is static. |
6183 */ | 6195 */ |
6184 void set static(bool isStatic) { | 6196 void set static(bool isStatic) { |
6185 assert(serializedExecutable == null); | 6197 _assertNotResynthesized(serializedExecutable); |
6186 setModifier(Modifier.STATIC, isStatic); | 6198 setModifier(Modifier.STATIC, isStatic); |
6187 } | 6199 } |
6188 | 6200 |
6189 @override | 6201 @override |
6190 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 6202 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
6191 | 6203 |
6192 @override | 6204 @override |
6193 void appendTo(StringBuffer buffer) { | 6205 void appendTo(StringBuffer buffer) { |
6194 buffer.write(displayName); | 6206 buffer.write(displayName); |
6195 super.appendTo(buffer); | 6207 super.appendTo(buffer); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6677 @override | 6689 @override |
6678 int get codeOffset { | 6690 int get codeOffset { |
6679 if (_unlinkedVariable != null) { | 6691 if (_unlinkedVariable != null) { |
6680 return _unlinkedVariable.codeRange?.offset; | 6692 return _unlinkedVariable.codeRange?.offset; |
6681 } | 6693 } |
6682 return super.codeOffset; | 6694 return super.codeOffset; |
6683 } | 6695 } |
6684 | 6696 |
6685 @override | 6697 @override |
6686 void set const3(bool isConst) { | 6698 void set const3(bool isConst) { |
6687 assert(_unlinkedVariable == null); | 6699 _assertNotResynthesized(_unlinkedVariable); |
6688 super.const3 = isConst; | 6700 super.const3 = isConst; |
6689 } | 6701 } |
6690 | 6702 |
6691 @override | 6703 @override |
6692 String get documentationComment { | 6704 String get documentationComment { |
6693 if (_unlinkedVariable != null) { | 6705 if (_unlinkedVariable != null) { |
6694 return _unlinkedVariable?.documentationComment?.text; | 6706 return _unlinkedVariable?.documentationComment?.text; |
6695 } | 6707 } |
6696 return super.documentationComment; | 6708 return super.documentationComment; |
6697 } | 6709 } |
6698 | 6710 |
6699 @override | 6711 @override |
6700 void set final2(bool isFinal) { | 6712 void set final2(bool isFinal) { |
6701 assert(_unlinkedVariable == null); | 6713 _assertNotResynthesized(_unlinkedVariable); |
6702 super.final2 = isFinal; | 6714 super.final2 = isFinal; |
6703 } | 6715 } |
6704 | 6716 |
6705 @override | 6717 @override |
6706 bool get hasImplicitType { | 6718 bool get hasImplicitType { |
6707 if (_unlinkedVariable != null) { | 6719 if (_unlinkedVariable != null) { |
6708 return _unlinkedVariable.type == null; | 6720 return _unlinkedVariable.type == null; |
6709 } | 6721 } |
6710 return super.hasImplicitType; | 6722 return super.hasImplicitType; |
6711 } | 6723 } |
6712 | 6724 |
6713 @override | 6725 @override |
6714 void set hasImplicitType(bool hasImplicitType) { | 6726 void set hasImplicitType(bool hasImplicitType) { |
6715 assert(_unlinkedVariable == null); | 6727 _assertNotResynthesized(_unlinkedVariable); |
6716 super.hasImplicitType = hasImplicitType; | 6728 super.hasImplicitType = hasImplicitType; |
6717 } | 6729 } |
6718 | 6730 |
6719 @override | 6731 @override |
6720 FunctionElement get initializer { | 6732 FunctionElement get initializer { |
6721 if (_unlinkedVariable != null && _initializer == null) { | 6733 if (_unlinkedVariable != null && _initializer == null) { |
6722 UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer; | 6734 UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer; |
6723 if (unlinkedInitializer != null) { | 6735 if (unlinkedInitializer != null) { |
6724 _initializer = new FunctionElementImpl.forSerialized( | 6736 _initializer = new FunctionElementImpl.forSerialized( |
6725 unlinkedInitializer, this)..synthetic = true; | 6737 unlinkedInitializer, this)..synthetic = true; |
6726 } else { | 6738 } else { |
6727 return null; | 6739 return null; |
6728 } | 6740 } |
6729 } | 6741 } |
6730 return super.initializer; | 6742 return super.initializer; |
6731 } | 6743 } |
6732 | 6744 |
6733 /** | 6745 /** |
6734 * Set the function representing this variable's initializer to the given | 6746 * Set the function representing this variable's initializer to the given |
6735 * [function]. | 6747 * [function]. |
6736 */ | 6748 */ |
6737 void set initializer(FunctionElement function) { | 6749 void set initializer(FunctionElement function) { |
6738 assert(_unlinkedVariable == null); | 6750 _assertNotResynthesized(_unlinkedVariable); |
6739 super.initializer = function; | 6751 super.initializer = function; |
6740 } | 6752 } |
6741 | 6753 |
6742 @override | 6754 @override |
6743 bool get isConst { | 6755 bool get isConst { |
6744 if (_unlinkedVariable != null) { | 6756 if (_unlinkedVariable != null) { |
6745 return _unlinkedVariable.isConst; | 6757 return _unlinkedVariable.isConst; |
6746 } | 6758 } |
6747 return super.isConst; | 6759 return super.isConst; |
6748 } | 6760 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6786 if (_unlinkedVariable != null && _type == null) { | 6798 if (_unlinkedVariable != null && _type == null) { |
6787 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( | 6799 _type = enclosingUnit.resynthesizerContext.resolveLinkedType( |
6788 _unlinkedVariable.inferredTypeSlot, typeParameterContext) ?? | 6800 _unlinkedVariable.inferredTypeSlot, typeParameterContext) ?? |
6789 enclosingUnit.resynthesizerContext | 6801 enclosingUnit.resynthesizerContext |
6790 .resolveTypeRef(_unlinkedVariable.type, typeParameterContext); | 6802 .resolveTypeRef(_unlinkedVariable.type, typeParameterContext); |
6791 } | 6803 } |
6792 return super.type; | 6804 return super.type; |
6793 } | 6805 } |
6794 | 6806 |
6795 void set type(DartType type) { | 6807 void set type(DartType type) { |
6796 assert(_unlinkedVariable == null); | 6808 _assertNotResynthesized(_unlinkedVariable); |
6797 _type = type; | 6809 _type = type; |
6798 } | 6810 } |
6799 | 6811 |
6800 /** | 6812 /** |
6801 * Subclasses need this getter, see [ConstVariableElement._unlinkedConst]. | 6813 * Subclasses need this getter, see [ConstVariableElement._unlinkedConst]. |
6802 */ | 6814 */ |
6803 UnlinkedConst get _unlinkedConst => _unlinkedVariable?.initializer?.bodyExpr; | 6815 UnlinkedConst get _unlinkedConst => _unlinkedVariable?.initializer?.bodyExpr; |
6804 } | 6816 } |
6805 | 6817 |
6806 /** | 6818 /** |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6924 @override | 6936 @override |
6925 int get codeOffset { | 6937 int get codeOffset { |
6926 if (_unlinkedParam != null) { | 6938 if (_unlinkedParam != null) { |
6927 return _unlinkedParam.codeRange?.offset; | 6939 return _unlinkedParam.codeRange?.offset; |
6928 } | 6940 } |
6929 return super.codeOffset; | 6941 return super.codeOffset; |
6930 } | 6942 } |
6931 | 6943 |
6932 @override | 6944 @override |
6933 void set const3(bool isConst) { | 6945 void set const3(bool isConst) { |
6934 assert(_unlinkedParam == null); | 6946 _assertNotResynthesized(_unlinkedParam); |
6935 super.const3 = isConst; | 6947 super.const3 = isConst; |
6936 } | 6948 } |
6937 | 6949 |
6938 @override | 6950 @override |
6939 String get defaultValueCode { | 6951 String get defaultValueCode { |
6940 if (_unlinkedParam != null) { | 6952 if (_unlinkedParam != null) { |
6941 if (_unlinkedParam.initializer?.bodyExpr == null) { | 6953 if (_unlinkedParam.initializer?.bodyExpr == null) { |
6942 return null; | 6954 return null; |
6943 } | 6955 } |
6944 return _unlinkedParam.defaultValueCode; | 6956 return _unlinkedParam.defaultValueCode; |
6945 } | 6957 } |
6946 return _defaultValueCode; | 6958 return _defaultValueCode; |
6947 } | 6959 } |
6948 | 6960 |
6949 /** | 6961 /** |
6950 * Set Dart code of the default value. | 6962 * Set Dart code of the default value. |
6951 */ | 6963 */ |
6952 void set defaultValueCode(String defaultValueCode) { | 6964 void set defaultValueCode(String defaultValueCode) { |
6953 assert(_unlinkedParam == null); | 6965 _assertNotResynthesized(_unlinkedParam); |
6954 this._defaultValueCode = StringUtilities.intern(defaultValueCode); | 6966 this._defaultValueCode = StringUtilities.intern(defaultValueCode); |
6955 } | 6967 } |
6956 | 6968 |
6957 @override | 6969 @override |
6958 void set final2(bool isFinal) { | 6970 void set final2(bool isFinal) { |
6959 assert(_unlinkedParam == null); | 6971 _assertNotResynthesized(_unlinkedParam); |
6960 super.final2 = isFinal; | 6972 super.final2 = isFinal; |
6961 } | 6973 } |
6962 | 6974 |
6963 @override | 6975 @override |
6964 bool get hasImplicitType { | 6976 bool get hasImplicitType { |
6965 if (_unlinkedParam != null) { | 6977 if (_unlinkedParam != null) { |
6966 return _unlinkedParam.type == null; | 6978 return _unlinkedParam.type == null; |
6967 } | 6979 } |
6968 return super.hasImplicitType; | 6980 return super.hasImplicitType; |
6969 } | 6981 } |
6970 | 6982 |
6971 @override | 6983 @override |
6972 void set hasImplicitType(bool hasImplicitType) { | 6984 void set hasImplicitType(bool hasImplicitType) { |
6973 assert(_unlinkedParam == null); | 6985 _assertNotResynthesized(_unlinkedParam); |
6974 super.hasImplicitType = hasImplicitType; | 6986 super.hasImplicitType = hasImplicitType; |
6975 } | 6987 } |
6976 | 6988 |
6977 /** | 6989 /** |
6978 * True if this parameter inherits from a covariant parameter. This happens | 6990 * True if this parameter inherits from a covariant parameter. This happens |
6979 * when it overrides a method in a supertype that has a corresponding | 6991 * when it overrides a method in a supertype that has a corresponding |
6980 * covariant parameter. | 6992 * covariant parameter. |
6981 */ | 6993 */ |
6982 bool get inheritsCovariant { | 6994 bool get inheritsCovariant { |
6983 if (_unlinkedParam != null) { | 6995 if (_unlinkedParam != null) { |
6984 return enclosingUnit.resynthesizerContext | 6996 return enclosingUnit.resynthesizerContext |
6985 .inheritsCovariant(_unlinkedParam.inheritsCovariantSlot); | 6997 .inheritsCovariant(_unlinkedParam.inheritsCovariantSlot); |
6986 } else { | 6998 } else { |
6987 return _inheritsCovariant; | 6999 return _inheritsCovariant; |
6988 } | 7000 } |
6989 } | 7001 } |
6990 | 7002 |
6991 /** | 7003 /** |
6992 * Record whether or not this parameter inherits from a covariant parameter. | 7004 * Record whether or not this parameter inherits from a covariant parameter. |
6993 */ | 7005 */ |
6994 void set inheritsCovariant(bool value) { | 7006 void set inheritsCovariant(bool value) { |
6995 assert(_unlinkedParam == null); | 7007 _assertNotResynthesized(_unlinkedParam); |
6996 _inheritsCovariant = value; | 7008 _inheritsCovariant = value; |
6997 } | 7009 } |
6998 | 7010 |
6999 @override | 7011 @override |
7000 FunctionElement get initializer { | 7012 FunctionElement get initializer { |
7001 if (_unlinkedParam != null && _initializer == null) { | 7013 if (_unlinkedParam != null && _initializer == null) { |
7002 UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer; | 7014 UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer; |
7003 if (unlinkedInitializer != null) { | 7015 if (unlinkedInitializer != null) { |
7004 _initializer = new FunctionElementImpl.forSerialized( | 7016 _initializer = new FunctionElementImpl.forSerialized( |
7005 unlinkedInitializer, this)..synthetic = true; | 7017 unlinkedInitializer, this)..synthetic = true; |
7006 } else { | 7018 } else { |
7007 return null; | 7019 return null; |
7008 } | 7020 } |
7009 } | 7021 } |
7010 return super.initializer; | 7022 return super.initializer; |
7011 } | 7023 } |
7012 | 7024 |
7013 /** | 7025 /** |
7014 * Set the function representing this variable's initializer to the given | 7026 * Set the function representing this variable's initializer to the given |
7015 * [function]. | 7027 * [function]. |
7016 */ | 7028 */ |
7017 void set initializer(FunctionElement function) { | 7029 void set initializer(FunctionElement function) { |
7018 assert(_unlinkedParam == null); | 7030 _assertNotResynthesized(_unlinkedParam); |
7019 super.initializer = function; | 7031 super.initializer = function; |
7020 } | 7032 } |
7021 | 7033 |
7022 @override | 7034 @override |
7023 bool get isConst { | 7035 bool get isConst { |
7024 if (_unlinkedParam != null) { | 7036 if (_unlinkedParam != null) { |
7025 return false; | 7037 return false; |
7026 } | 7038 } |
7027 return super.isConst; | 7039 return super.isConst; |
7028 } | 7040 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7101 break; | 7113 break; |
7102 case UnlinkedParamKind.required: | 7114 case UnlinkedParamKind.required: |
7103 _parameterKind = ParameterKind.REQUIRED; | 7115 _parameterKind = ParameterKind.REQUIRED; |
7104 break; | 7116 break; |
7105 } | 7117 } |
7106 } | 7118 } |
7107 return _parameterKind; | 7119 return _parameterKind; |
7108 } | 7120 } |
7109 | 7121 |
7110 void set parameterKind(ParameterKind parameterKind) { | 7122 void set parameterKind(ParameterKind parameterKind) { |
7111 assert(_unlinkedParam == null); | 7123 _assertNotResynthesized(_unlinkedParam); |
7112 _parameterKind = parameterKind; | 7124 _parameterKind = parameterKind; |
7113 } | 7125 } |
7114 | 7126 |
7115 @override | 7127 @override |
7116 List<ParameterElement> get parameters { | 7128 List<ParameterElement> get parameters { |
7117 _resynthesizeTypeAndParameters(); | 7129 _resynthesizeTypeAndParameters(); |
7118 return _parameters; | 7130 return _parameters; |
7119 } | 7131 } |
7120 | 7132 |
7121 /** | 7133 /** |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7204 } | 7216 } |
7205 } | 7217 } |
7206 return null; | 7218 return null; |
7207 } | 7219 } |
7208 | 7220 |
7209 /** | 7221 /** |
7210 * Set the visible range for this element to the range starting at the given | 7222 * Set the visible range for this element to the range starting at the given |
7211 * [offset] with the given [length]. | 7223 * [offset] with the given [length]. |
7212 */ | 7224 */ |
7213 void setVisibleRange(int offset, int length) { | 7225 void setVisibleRange(int offset, int length) { |
7214 assert(_unlinkedParam == null); | 7226 _assertNotResynthesized(_unlinkedParam); |
7215 _visibleRangeOffset = offset; | 7227 _visibleRangeOffset = offset; |
7216 _visibleRangeLength = length; | 7228 _visibleRangeLength = length; |
7217 } | 7229 } |
7218 | 7230 |
7219 @override | 7231 @override |
7220 void visitChildren(ElementVisitor visitor) { | 7232 void visitChildren(ElementVisitor visitor) { |
7221 super.visitChildren(visitor); | 7233 super.visitChildren(visitor); |
7222 safelyVisitChildren(parameters, visitor); | 7234 safelyVisitChildren(parameters, visitor); |
7223 } | 7235 } |
7224 | 7236 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7456 : super(variable.name, variable.nameOffset) { | 7468 : super(variable.name, variable.nameOffset) { |
7457 this.variable = variable; | 7469 this.variable = variable; |
7458 static = variable.isStatic; | 7470 static = variable.isStatic; |
7459 synthetic = true; | 7471 synthetic = true; |
7460 } | 7472 } |
7461 | 7473 |
7462 /** | 7474 /** |
7463 * Set whether this accessor is abstract. | 7475 * Set whether this accessor is abstract. |
7464 */ | 7476 */ |
7465 void set abstract(bool isAbstract) { | 7477 void set abstract(bool isAbstract) { |
7466 assert(serializedExecutable == null); | 7478 _assertNotResynthesized(serializedExecutable); |
7467 setModifier(Modifier.ABSTRACT, isAbstract); | 7479 setModifier(Modifier.ABSTRACT, isAbstract); |
7468 } | 7480 } |
7469 | 7481 |
7470 @override | 7482 @override |
7471 List<TypeParameterType> get allEnclosingTypeParameterTypes { | 7483 List<TypeParameterType> get allEnclosingTypeParameterTypes { |
7472 if (isStatic) { | 7484 if (isStatic) { |
7473 return const <TypeParameterType>[]; | 7485 return const <TypeParameterType>[]; |
7474 } | 7486 } |
7475 return super.allEnclosingTypeParameterTypes; | 7487 return super.allEnclosingTypeParameterTypes; |
7476 } | 7488 } |
(...skipping 26 matching lines...) Expand all Loading... |
7503 | 7515 |
7504 @override | 7516 @override |
7505 TypeParameterizedElementMixin get enclosingTypeParameterContext { | 7517 TypeParameterizedElementMixin get enclosingTypeParameterContext { |
7506 return (enclosingElement as ElementImpl).typeParameterContext; | 7518 return (enclosingElement as ElementImpl).typeParameterContext; |
7507 } | 7519 } |
7508 | 7520 |
7509 /** | 7521 /** |
7510 * Set whether this accessor is a getter. | 7522 * Set whether this accessor is a getter. |
7511 */ | 7523 */ |
7512 void set getter(bool isGetter) { | 7524 void set getter(bool isGetter) { |
7513 assert(serializedExecutable == null); | 7525 _assertNotResynthesized(serializedExecutable); |
7514 setModifier(Modifier.GETTER, isGetter); | 7526 setModifier(Modifier.GETTER, isGetter); |
7515 } | 7527 } |
7516 | 7528 |
7517 @override | 7529 @override |
7518 String get identifier { | 7530 String get identifier { |
7519 String name = displayName; | 7531 String name = displayName; |
7520 String suffix = isGetter ? "?" : "="; | 7532 String suffix = isGetter ? "?" : "="; |
7521 return "$name$suffix"; | 7533 return "$name$suffix"; |
7522 } | 7534 } |
7523 | 7535 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7562 if (isSetter) { | 7574 if (isSetter) { |
7563 return "${super.name}="; | 7575 return "${super.name}="; |
7564 } | 7576 } |
7565 return super.name; | 7577 return super.name; |
7566 } | 7578 } |
7567 | 7579 |
7568 /** | 7580 /** |
7569 * Set whether this accessor is a setter. | 7581 * Set whether this accessor is a setter. |
7570 */ | 7582 */ |
7571 void set setter(bool isSetter) { | 7583 void set setter(bool isSetter) { |
7572 assert(serializedExecutable == null); | 7584 _assertNotResynthesized(serializedExecutable); |
7573 setModifier(Modifier.SETTER, isSetter); | 7585 setModifier(Modifier.SETTER, isSetter); |
7574 } | 7586 } |
7575 | 7587 |
7576 /** | 7588 /** |
7577 * Set whether this accessor is static. | 7589 * Set whether this accessor is static. |
7578 */ | 7590 */ |
7579 void set static(bool isStatic) { | 7591 void set static(bool isStatic) { |
7580 assert(serializedExecutable == null); | 7592 _assertNotResynthesized(serializedExecutable); |
7581 setModifier(Modifier.STATIC, isStatic); | 7593 setModifier(Modifier.STATIC, isStatic); |
7582 } | 7594 } |
7583 | 7595 |
7584 @override | 7596 @override |
7585 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 7597 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
7586 | 7598 |
7587 @override | 7599 @override |
7588 void appendTo(StringBuffer buffer) { | 7600 void appendTo(StringBuffer buffer) { |
7589 buffer.write(isGetter ? "get " : "set "); | 7601 buffer.write(isGetter ? "get " : "set "); |
7590 buffer.write(variable.displayName); | 7602 buffer.write(variable.displayName); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7732 @override | 7744 @override |
7733 DartType get propagatedType { | 7745 DartType get propagatedType { |
7734 if (_unlinkedVariable != null && _propagatedType == null) { | 7746 if (_unlinkedVariable != null && _propagatedType == null) { |
7735 _propagatedType = enclosingUnit.resynthesizerContext.resolveLinkedType( | 7747 _propagatedType = enclosingUnit.resynthesizerContext.resolveLinkedType( |
7736 _unlinkedVariable.propagatedTypeSlot, typeParameterContext); | 7748 _unlinkedVariable.propagatedTypeSlot, typeParameterContext); |
7737 } | 7749 } |
7738 return _propagatedType; | 7750 return _propagatedType; |
7739 } | 7751 } |
7740 | 7752 |
7741 void set propagatedType(DartType propagatedType) { | 7753 void set propagatedType(DartType propagatedType) { |
7742 assert(_unlinkedVariable == null); | 7754 _assertNotResynthesized(_unlinkedVariable); |
7743 _propagatedType = propagatedType; | 7755 _propagatedType = propagatedType; |
7744 } | 7756 } |
7745 } | 7757 } |
7746 | 7758 |
7747 /** | 7759 /** |
7748 * The context in which elements are resynthesized. | 7760 * The context in which elements are resynthesized. |
7749 */ | 7761 */ |
7750 abstract class ResynthesizerContext { | 7762 abstract class ResynthesizerContext { |
7751 /** | 7763 /** |
7752 * Build [ElementAnnotationImpl] for the given [UnlinkedConst]. | 7764 * Build [ElementAnnotationImpl] for the given [UnlinkedConst]. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7839 | 7851 |
7840 @override | 7852 @override |
7841 int get end { | 7853 int get end { |
7842 if (_unlinkedCombinator != null) { | 7854 if (_unlinkedCombinator != null) { |
7843 return _unlinkedCombinator.end; | 7855 return _unlinkedCombinator.end; |
7844 } | 7856 } |
7845 return _end; | 7857 return _end; |
7846 } | 7858 } |
7847 | 7859 |
7848 void set end(int end) { | 7860 void set end(int end) { |
7849 assert(_unlinkedCombinator == null); | 7861 _assertNotResynthesized(_unlinkedCombinator); |
7850 _end = end; | 7862 _end = end; |
7851 } | 7863 } |
7852 | 7864 |
7853 @override | 7865 @override |
7854 int get offset { | 7866 int get offset { |
7855 if (_unlinkedCombinator != null) { | 7867 if (_unlinkedCombinator != null) { |
7856 return _unlinkedCombinator.offset; | 7868 return _unlinkedCombinator.offset; |
7857 } | 7869 } |
7858 return _offset; | 7870 return _offset; |
7859 } | 7871 } |
7860 | 7872 |
7861 void set offset(int offset) { | 7873 void set offset(int offset) { |
7862 assert(_unlinkedCombinator == null); | 7874 _assertNotResynthesized(_unlinkedCombinator); |
7863 _offset = offset; | 7875 _offset = offset; |
7864 } | 7876 } |
7865 | 7877 |
7866 @override | 7878 @override |
7867 List<String> get shownNames { | 7879 List<String> get shownNames { |
7868 if (_unlinkedCombinator != null) { | 7880 if (_unlinkedCombinator != null) { |
7869 _shownNames ??= _unlinkedCombinator.shows.toList(growable: false); | 7881 _shownNames ??= _unlinkedCombinator.shows.toList(growable: false); |
7870 } | 7882 } |
7871 return _shownNames ?? const <String>[]; | 7883 return _shownNames ?? const <String>[]; |
7872 } | 7884 } |
7873 | 7885 |
7874 void set shownNames(List<String> shownNames) { | 7886 void set shownNames(List<String> shownNames) { |
7875 assert(_unlinkedCombinator == null); | 7887 _assertNotResynthesized(_unlinkedCombinator); |
7876 _shownNames = shownNames; | 7888 _shownNames = shownNames; |
7877 } | 7889 } |
7878 | 7890 |
7879 @override | 7891 @override |
7880 String toString() { | 7892 String toString() { |
7881 StringBuffer buffer = new StringBuffer(); | 7893 StringBuffer buffer = new StringBuffer(); |
7882 buffer.write("show "); | 7894 buffer.write("show "); |
7883 int count = shownNames.length; | 7895 int count = shownNames.length; |
7884 for (int i = 0; i < count; i++) { | 7896 for (int i = 0; i < count; i++) { |
7885 if (i > 0) { | 7897 if (i > 0) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7999 return null; | 8011 return null; |
8000 } | 8012 } |
8001 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( | 8013 return _bound ??= enclosingUnit.resynthesizerContext.resolveTypeRef( |
8002 _unlinkedTypeParam.bound, enclosingElement, | 8014 _unlinkedTypeParam.bound, enclosingElement, |
8003 instantiateToBoundsAllowed: false); | 8015 instantiateToBoundsAllowed: false); |
8004 } | 8016 } |
8005 return _bound; | 8017 return _bound; |
8006 } | 8018 } |
8007 | 8019 |
8008 void set bound(DartType bound) { | 8020 void set bound(DartType bound) { |
8009 assert(_unlinkedTypeParam == null); | 8021 _assertNotResynthesized(_unlinkedTypeParam); |
8010 _bound = bound; | 8022 _bound = bound; |
8011 } | 8023 } |
8012 | 8024 |
8013 @override | 8025 @override |
8014 int get codeLength { | 8026 int get codeLength { |
8015 if (_unlinkedTypeParam != null) { | 8027 if (_unlinkedTypeParam != null) { |
8016 return _unlinkedTypeParam.codeRange?.length; | 8028 return _unlinkedTypeParam.codeRange?.length; |
8017 } | 8029 } |
8018 return super.codeLength; | 8030 return super.codeLength; |
8019 } | 8031 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8467 | 8479 |
8468 @override | 8480 @override |
8469 void visitElement(Element element) { | 8481 void visitElement(Element element) { |
8470 int offset = element.nameOffset; | 8482 int offset = element.nameOffset; |
8471 if (offset != -1) { | 8483 if (offset != -1) { |
8472 map[offset] = element; | 8484 map[offset] = element; |
8473 } | 8485 } |
8474 super.visitElement(element); | 8486 super.visitElement(element); |
8475 } | 8487 } |
8476 } | 8488 } |
OLD | NEW |