Skip to content

Commit 2b5d262

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Write declared LocalVariableFragmentImpl, and its element.
Change-Id: I9d532a3c71992793b2071646c5ef81e65f836755 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438604 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent f0b83bf commit 2b5d262

24 files changed

+994
-452
lines changed

pkg/analyzer/test/src/dart/resolution/cast_pattern_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ CastPattern
3030
pattern: DeclaredVariablePattern
3131
keyword: var
3232
name: y
33-
declaredElement: hasImplicitType y@29
34-
type: int
33+
declaredFragment: isPublic y@29
34+
type: null
35+
element: hasImplicitType isPublic
36+
type: int
3537
matchedValueType: int
3638
asToken: as
3739
type: NamedType
@@ -88,8 +90,10 @@ PatternVariableDeclaration
8890
pattern: CastPattern
8991
pattern: DeclaredVariablePattern
9092
name: a
91-
declaredElement: hasImplicitType a@19
92-
type: int
93+
declaredFragment: isPublic a@19
94+
type: null
95+
element: hasImplicitType isPublic
96+
type: int
9397
matchedValueType: int
9498
asToken: as
9599
type: NamedType

pkg/analyzer/test/src/dart/resolution/declared_variable_pattern_test.dart

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ void f(int x) {
3232
DeclaredVariablePattern
3333
keyword: final
3434
name: y
35-
declaredElement: hasImplicitType isFinal y@46
36-
type: int
35+
declaredFragment: isFinal isPublic y@46
36+
type: null
37+
element: hasImplicitType isFinal isPublic
38+
type: int
3739
matchedValueType: int
3840
''');
3941
}
@@ -59,8 +61,10 @@ DeclaredVariablePattern
5961
element2: dart:core::@class::int
6062
type: int
6163
name: y
62-
declaredElement: isFinal y@46
64+
declaredFragment: isFinal isPublic y@46
6365
type: int
66+
element: isFinal isPublic
67+
type: int
6468
matchedValueType: dynamic
6569
''');
6670
}
@@ -79,8 +83,10 @@ ListPattern
7983
elements
8084
DeclaredVariablePattern
8185
name: a
82-
declaredElement: hasImplicitType isFinal a@54
83-
type: int
86+
declaredFragment: isFinal isPublic a@54
87+
type: null
88+
element: hasImplicitType isFinal isPublic
89+
type: int
8490
matchedValueType: int
8591
rightBracket: ]
8692
matchedValueType: List<int>
@@ -104,8 +110,10 @@ ListPattern
104110
operator: ...
105111
pattern: DeclaredVariablePattern
106112
name: a
107-
declaredElement: hasImplicitType isFinal a@57
108-
type: List<int>
113+
declaredFragment: isFinal isPublic a@57
114+
type: null
115+
element: hasImplicitType isFinal isPublic
116+
type: List<int>
109117
matchedValueType: List<int>
110118
rightBracket: ]
111119
matchedValueType: List<int>
@@ -132,8 +140,10 @@ MapPattern
132140
separator: :
133141
value: DeclaredVariablePattern
134142
name: a
135-
declaredElement: hasImplicitType isFinal a@57
136-
type: int
143+
declaredFragment: isFinal isPublic a@57
144+
type: null
145+
element: hasImplicitType isFinal isPublic
146+
type: int
137147
matchedValueType: int
138148
rightBracket: }
139149
matchedValueType: Map<int, int>
@@ -163,8 +173,10 @@ ObjectPattern
163173
colon: :
164174
pattern: DeclaredVariablePattern
165175
name: a
166-
declaredElement: hasImplicitType isFinal a@63
167-
type: int
176+
declaredFragment: isFinal isPublic a@63
177+
type: null
178+
element: hasImplicitType isFinal isPublic
179+
type: int
168180
matchedValueType: int
169181
element2: dart:core::@class::int::@getter::sign
170182
rightParenthesis: )
@@ -185,8 +197,10 @@ ParenthesizedPattern
185197
leftParenthesis: (
186198
pattern: DeclaredVariablePattern
187199
name: a
188-
declaredElement: hasImplicitType isFinal a@54
189-
type: int
200+
declaredFragment: isFinal isPublic a@54
201+
type: null
202+
element: hasImplicitType isFinal isPublic
203+
type: int
190204
matchedValueType: int
191205
rightParenthesis: )
192206
matchedValueType: int
@@ -208,8 +222,10 @@ RecordPattern
208222
PatternField
209223
pattern: DeclaredVariablePattern
210224
name: a
211-
declaredElement: hasImplicitType isFinal a@54
212-
type: int
225+
declaredFragment: isFinal isPublic a@54
226+
type: null
227+
element: hasImplicitType isFinal isPublic
228+
type: int
213229
matchedValueType: int
214230
element2: <null>
215231
rightParenthesis: )
@@ -237,8 +253,10 @@ DeclaredVariablePattern
237253
element2: dart:core::@class::int
238254
type: int
239255
name: y
240-
declaredElement: y@40
256+
declaredFragment: isPublic y@40
241257
type: int
258+
element: isPublic
259+
type: int
242260
matchedValueType: dynamic
243261
''');
244262
}
@@ -260,8 +278,10 @@ void f<T>(T x) {
260278
DeclaredVariablePattern
261279
keyword: var
262280
name: y
263-
declaredElement: hasImplicitType y@54
264-
type: T
281+
declaredFragment: isPublic y@54
282+
type: null
283+
element: hasImplicitType isPublic
284+
type: T
265285
matchedValueType: T & int
266286
''');
267287
}
@@ -280,8 +300,10 @@ void f(int x) {
280300
DeclaredVariablePattern
281301
keyword: var
282302
name: y
283-
declaredElement: hasImplicitType y@33
284-
type: int
303+
declaredFragment: isPublic y@33
304+
type: null
305+
element: hasImplicitType isPublic
306+
type: int
285307
matchedValueType: int
286308
''');
287309
}
@@ -300,8 +322,10 @@ void f(Never? x) {
300322
DeclaredVariablePattern
301323
keyword: var
302324
name: y
303-
declaredElement: hasImplicitType y@36
304-
type: dynamic
325+
declaredFragment: isPublic y@36
326+
type: null
327+
element: hasImplicitType isPublic
328+
type: dynamic
305329
matchedValueType: Never?
306330
''');
307331
}
@@ -320,8 +344,10 @@ void f(Null x) {
320344
DeclaredVariablePattern
321345
keyword: var
322346
name: y
323-
declaredElement: hasImplicitType y@34
324-
type: dynamic
347+
declaredFragment: isPublic y@34
348+
type: null
349+
element: hasImplicitType isPublic
350+
type: dynamic
325351
matchedValueType: Null
326352
''');
327353
}
@@ -343,8 +369,10 @@ void f(int x) {
343369
DeclaredVariablePattern
344370
keyword: var
345371
name: y
346-
declaredElement: hasImplicitType y@44
347-
type: int
372+
declaredFragment: isPublic y@44
373+
type: null
374+
element: hasImplicitType isPublic
375+
type: int
348376
matchedValueType: int
349377
''');
350378
}
@@ -367,8 +395,10 @@ CastPattern
367395
pattern: DeclaredVariablePattern
368396
keyword: var
369397
name: y
370-
declaredElement: hasImplicitType y@44
371-
type: int
398+
declaredFragment: isPublic y@44
399+
type: null
400+
element: hasImplicitType isPublic
401+
type: int
372402
matchedValueType: int
373403
asToken: as
374404
type: NamedType

0 commit comments

Comments
 (0)