Skip to content

Commit d5e914a

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Fix InstanceElementImpl2.name3, return firstFragment.name2, nullable.
Change-Id: Idd7239c1be692219f1f1ba735f475fe0141c0c6c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430821 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 823b666 commit d5e914a

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4544,7 +4544,7 @@ abstract class InstanceElementImpl2 extends ElementImpl2
45444544
List<MethodElementImpl2> get methods2 => methods;
45454545

45464546
@override
4547-
String? get name3 => firstFragment.name;
4547+
String? get name3 => firstFragment.name2;
45484548

45494549
@override
45504550
Element get nonSynthetic2 => isSynthetic ? enclosingElement : this as Element;

pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ class _MockSdkElementsBuilder {
969969
required LibraryFragmentImpl unit,
970970
}) {
971971
var fragment = ClassFragmentImpl(name, 0);
972+
fragment.name2 = name;
972973
ClassElementImpl2(Reference.root(), fragment);
973974
fragment.typeParameters =
974975
typeParameters.map((tp) => tp.firstFragment).toList();

pkg/analyzer/test/generated/elements_types_mixin.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ mixin ElementsTypesMixin {
155155
List<MethodElementImpl2> methods = const [],
156156
}) {
157157
var fragment = ClassFragmentImpl(name, 0);
158+
fragment.name2 = name;
158159
fragment.isAbstract = isAbstract;
159160
fragment.isAugmentation = isAugmentation;
160161
fragment.isSealed = isSealed;
@@ -479,6 +480,7 @@ mixin ElementsTypesMixin {
479480
List<InterfaceTypeImpl> interfaces = const [],
480481
}) {
481482
var fragment = MixinFragmentImpl(name, 0);
483+
fragment.name2 = name;
482484
fragment.isAugmentation = isAugmentation;
483485
fragment.enclosingElement3 = testLibrary.definingCompilationUnit;
484486
fragment.typeParameters = typeParameters.map((e) => e.asElement).toList();
@@ -500,6 +502,7 @@ mixin ElementsTypesMixin {
500502
List<InterfaceTypeImpl> interfaces = const [],
501503
}) {
502504
var fragment = MixinFragmentImpl(name, 0);
505+
fragment.name2 = name;
503506
fragment.isAugmentation = isAugmentation;
504507
fragment.enclosingElement3 = testLibrary.definingCompilationUnit;
505508
fragment.typeParameters = typeParameters.map((e) => e.asElement).toList();

pkg/analyzer/test/src/summary/elements/class_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13104,7 +13104,7 @@ library
1310413104
element: <testLibraryFragment>::@class::0::@constructor::new#element
1310513105
typeName: null
1310613106
classes
13107-
class
13107+
class <null-name>
1310813108
reference: <testLibrary>::@class::0
1310913109
firstFragment: <testLibraryFragment>::@class::0
1311013110
constructors

pkg/analyzer/test/src/summary/elements/enum_test.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,13 +3096,13 @@ library
30963096
constructorName: ConstructorName
30973097
type: NamedType
30983098
name: <empty> @-1 <synthetic>
3099-
element2: <testLibrary>::@enum::0
3100-
type:
3101-
element: <testLibraryFragment>::@enum::0::@constructor::new#element
3099+
element2: <null>
3100+
type: InvalidType
3101+
element: <null>
31023102
argumentList: ArgumentList
31033103
leftParenthesis: ( @0
31043104
rightParenthesis: ) @0
3105-
staticType:
3105+
staticType: InvalidType
31063106
getter2: <testLibraryFragment>::@enum::0::@getter::v
31073107
synthetic values
31083108
reference: <testLibraryFragment>::@enum::0::@field::values
@@ -3114,9 +3114,9 @@ library
31143114
SimpleIdentifier
31153115
token: v @-1
31163116
element: <testLibraryFragment>::@enum::0::@getter::v#element
3117-
staticType:
3117+
staticType: InvalidType
31183118
rightBracket: ] @0
3119-
staticType: List<>
3119+
staticType: List<<null>>
31203120
getter2: <testLibraryFragment>::@enum::0::@getter::values
31213121
constructors
31223122
synthetic const new
@@ -3131,21 +3131,21 @@ library
31313131
reference: <testLibraryFragment>::@enum::0::@getter::values
31323132
element: <testLibraryFragment>::@enum::0::@getter::values#element
31333133
enums
3134-
enum
3134+
enum <null-name>
31353135
reference: <testLibrary>::@enum::0
31363136
firstFragment: <testLibraryFragment>::@enum::0
31373137
supertype: Enum
31383138
fields
31393139
static const enumConstant hasInitializer v
31403140
firstFragment: <testLibraryFragment>::@enum::0::@field::v
3141-
type:
3141+
type: InvalidType
31423142
constantInitializer
31433143
fragment: <testLibraryFragment>::@enum::0::@field::v
31443144
expression: expression_0
31453145
getter: <testLibraryFragment>::@enum::0::@getter::v#element
31463146
synthetic static const values
31473147
firstFragment: <testLibraryFragment>::@enum::0::@field::values
3148-
type: List<>
3148+
type: List<<null>>
31493149
constantInitializer
31503150
fragment: <testLibraryFragment>::@enum::0::@field::values
31513151
expression: expression_1
@@ -3156,10 +3156,10 @@ library
31563156
getters
31573157
synthetic static get v
31583158
firstFragment: <testLibraryFragment>::@enum::0::@getter::v
3159-
returnType:
3159+
returnType: InvalidType
31603160
synthetic static get values
31613161
firstFragment: <testLibraryFragment>::@enum::0::@getter::values
3162-
returnType: List<>
3162+
returnType: List<<null>>
31633163
''');
31643164
}
31653165

pkg/analyzer/test/src/summary/elements/extension_type_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ library
16211621
reference: <testLibraryFragment>::@extensionType::0::@getter::it
16221622
element: <testLibraryFragment>::@extensionType::0::@getter::it#element
16231623
extensionTypes
1624-
extension type
1624+
extension type <null-name>
16251625
reference: <testLibrary>::@extensionType::0
16261626
firstFragment: <testLibraryFragment>::@extensionType::0
16271627
representation: <testLibraryFragment>::@extensionType::0::@field::it#element

pkg/analyzer/test/src/summary/elements/mixin_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ library
14331433
reference: <testLibraryFragment>::@mixin::0
14341434
element: <testLibrary>::@mixin::0
14351435
mixins
1436-
mixin
1436+
mixin <null-name>
14371437
reference: <testLibrary>::@mixin::0
14381438
firstFragment: <testLibraryFragment>::@mixin::0
14391439
superclassConstraints

0 commit comments

Comments
 (0)