OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart2js.semantics_visitor_test; | 5 part of dart2js.semantics_visitor_test; |
6 | 6 |
7 const Map<String, List<Test>> SEND_TESTS = const { | 7 const Map<String, List<Test>> SEND_TESTS = const { |
8 'Parameters': const [ | 8 'Parameters': const [ |
9 // Parameters | 9 // Parameters |
10 const Test('m(o) => o;', | 10 const Test('m(o) => o;', |
11 const Visit(VisitKind.VISIT_PARAMETER_GET, | 11 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#o)')), |
12 element: 'parameter(m#o)')), | 12 const Test( |
13 const Test('m(o) { o = 42; }', | 13 'm(o) { o = 42; }', |
14 const Visit(VisitKind.VISIT_PARAMETER_SET, | 14 const Visit(VisitKind.VISIT_PARAMETER_SET, |
15 element: 'parameter(m#o)', | 15 element: 'parameter(m#o)', rhs: '42')), |
16 rhs:'42')), | 16 const Test( |
17 const Test('m(o) { o(null, 42); }', | 17 'm(o) { o(null, 42); }', |
18 const Visit(VisitKind.VISIT_PARAMETER_INVOKE, | 18 const Visit(VisitKind.VISIT_PARAMETER_INVOKE, |
19 element: 'parameter(m#o)', | 19 element: 'parameter(m#o)', |
20 arguments: '(null,42)', | 20 arguments: '(null,42)', |
21 selector: 'CallStructure(arity=2)')), | 21 selector: 'CallStructure(arity=2)')), |
22 const Test('m(final o) { o = 42; }', | 22 const Test( |
| 23 'm(final o) { o = 42; }', |
23 const Visit(VisitKind.VISIT_FINAL_PARAMETER_SET, | 24 const Visit(VisitKind.VISIT_FINAL_PARAMETER_SET, |
24 element: 'parameter(m#o)', | 25 element: 'parameter(m#o)', rhs: '42')), |
25 rhs:'42')), | |
26 ], | 26 ], |
27 'Local variables': const [ | 27 'Local variables': const [ |
28 // Local variables | 28 // Local variables |
29 const Test('m() { var o; return o; }', | 29 const Test( |
| 30 'm() { var o; return o; }', |
30 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET, | 31 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET, |
31 element: 'variable(m#o)')), | 32 element: 'variable(m#o)')), |
32 const Test('m() { var o; o = 42; }', | 33 const Test( |
| 34 'm() { var o; o = 42; }', |
33 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET, | 35 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET, |
34 element: 'variable(m#o)', | 36 element: 'variable(m#o)', rhs: '42')), |
35 rhs:'42')), | 37 const Test( |
36 const Test('m() { var o; o(null, 42); }', | 38 'm() { var o; o(null, 42); }', |
37 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE, | 39 const Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE, |
38 element: 'variable(m#o)', | 40 element: 'variable(m#o)', |
39 arguments: '(null,42)', | 41 arguments: '(null,42)', |
40 selector: 'CallStructure(arity=2)')), | 42 selector: 'CallStructure(arity=2)')), |
41 const Test('m() { final o = 0; o = 42; }', | 43 const Test( |
| 44 'm() { final o = 0; o = 42; }', |
42 const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET, | 45 const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET, |
43 element: 'variable(m#o)', | 46 element: 'variable(m#o)', rhs: '42')), |
44 rhs:'42')), | 47 const Test( |
45 const Test('m() { const o = 0; o = 42; }', | 48 'm() { const o = 0; o = 42; }', |
46 const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET, | 49 const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET, |
47 element: 'variable(m#o)', | 50 element: 'variable(m#o)', rhs: '42')), |
48 rhs:'42')), | |
49 ], | 51 ], |
50 'Local functions': const [ | 52 'Local functions': const [ |
51 // Local functions | 53 // Local functions |
52 const Test('m() { o(a, b) {}; return o; }', | 54 const Test( |
| 55 'm() { o(a, b) {}; return o; }', |
53 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET, | 56 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET, |
54 element: 'function(m#o)')), | 57 element: 'function(m#o)')), |
55 const Test('m() { o(a, b) {}; o(null, 42); }', | 58 const Test( |
| 59 'm() { o(a, b) {}; o(null, 42); }', |
56 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE, | 60 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE, |
57 element: 'function(m#o)', | 61 element: 'function(m#o)', |
58 arguments: '(null,42)', | 62 arguments: '(null,42)', |
59 selector: 'CallStructure(arity=2)')), | 63 selector: 'CallStructure(arity=2)')), |
60 const Test('m() { o(a) {}; o(null, 42); }', | 64 const Test( |
| 65 'm() { o(a) {}; o(null, 42); }', |
61 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INCOMPATIBLE_INVOKE, | 66 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INCOMPATIBLE_INVOKE, |
62 element: 'function(m#o)', | 67 element: 'function(m#o)', |
63 arguments: '(null,42)', | 68 arguments: '(null,42)', |
64 selector: 'CallStructure(arity=2)')), | 69 selector: 'CallStructure(arity=2)')), |
65 const Test('m() { o(a, b) {}; o = 42; }', | 70 const Test( |
| 71 'm() { o(a, b) {}; o = 42; }', |
66 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_SET, | 72 const Visit(VisitKind.VISIT_LOCAL_FUNCTION_SET, |
67 element: 'function(m#o)', | 73 element: 'function(m#o)', rhs: '42')), |
68 rhs: '42')), | |
69 ], | 74 ], |
70 'Static fields': const [ | 75 'Static fields': const [ |
71 // Static fields | 76 // Static fields |
72 const Test( | 77 const Test( |
73 ''' | 78 ''' |
74 class C { static var o; } | 79 class C { static var o; } |
75 m() => C.o; | 80 m() => C.o; |
76 ''', | 81 ''', |
77 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, | 82 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#o)')), |
78 element: 'field(C#o)')), | |
79 const Test.clazz( | 83 const Test.clazz( |
80 ''' | 84 ''' |
81 class C { | 85 class C { |
82 static var o; | 86 static var o; |
83 m() => o; | 87 m() => o; |
84 } | 88 } |
85 ''', | 89 ''', |
86 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, | 90 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#o)')), |
87 element: 'field(C#o)')), | |
88 const Test.clazz( | 91 const Test.clazz( |
89 ''' | 92 ''' |
90 class C { | 93 class C { |
91 static var o; | 94 static var o; |
92 m() => C.o; | 95 m() => C.o; |
93 } | 96 } |
94 ''', | 97 ''', |
95 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, | 98 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#o)')), |
96 element: 'field(C#o)')), | |
97 const Test.prefix( | 99 const Test.prefix( |
98 ''' | 100 ''' |
99 class C { | 101 class C { |
100 static var o; | 102 static var o; |
101 } | 103 } |
102 ''', | 104 ''', |
103 'm() => p.C.o;', | 105 'm() => p.C.o;', |
104 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, | 106 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#o)')), |
105 element: 'field(C#o)')), | |
106 const Test.clazz( | 107 const Test.clazz( |
107 ''' | 108 ''' |
108 class C { | 109 class C { |
109 var o; | 110 var o; |
110 static m() => o; | 111 static m() => o; |
111 } | 112 } |
112 ''', | 113 ''', |
113 const Visit(VisitKind.ERROR_INVALID_GET, | 114 const Visit(VisitKind.ERROR_INVALID_GET, |
114 error: MessageKind.NO_INSTANCE_AVAILABLE)), | 115 error: MessageKind.NO_INSTANCE_AVAILABLE)), |
115 const Test.prefix( | 116 const Test.prefix( |
116 ''' | 117 ''' |
117 class C { | 118 class C { |
118 static var o; | 119 static var o; |
119 } | 120 } |
120 ''', | 121 ''', |
121 'm() => p.C.o;', | 122 'm() => p.C.o;', |
122 const [ | 123 const [ |
123 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 124 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
124 element: 'prefix(p)'), | 125 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#o)'), |
125 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, | |
126 element: 'field(C#o)'), | |
127 ], | 126 ], |
128 isDeferred: true), | 127 isDeferred: true), |
129 const Test( | 128 const Test( |
130 ''' | 129 ''' |
131 class C { | 130 class C { |
132 var o; | 131 var o; |
133 } | 132 } |
134 m() => C.o; | 133 m() => C.o; |
135 ''', | 134 ''', |
136 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | 135 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), |
137 name: 'o')), | |
138 const Test( | 136 const Test( |
139 ''' | 137 ''' |
140 class C { | 138 class C { |
141 var o; | 139 var o; |
142 } | 140 } |
143 m() { C.o = 42; } | 141 m() { C.o = 42; } |
144 ''', | 142 ''', |
145 const Visit(VisitKind.VISIT_UNRESOLVED_SET, | 143 const Visit(VisitKind.VISIT_UNRESOLVED_SET, name: 'o', rhs: '42')), |
146 name: 'o', | |
147 rhs: '42')), | |
148 const Test( | 144 const Test( |
149 ''' | 145 ''' |
150 class C { | 146 class C { |
151 C.o(); | 147 C.o(); |
152 } | 148 } |
153 m() => C.o; | 149 m() => C.o; |
154 ''', | 150 ''', |
155 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | 151 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), |
156 name: 'o')), | |
157 const Test.prefix( | 152 const Test.prefix( |
158 ''' | 153 ''' |
159 ''', | 154 ''', |
160 'm() => p.C.o;', | 155 'm() => p.C.o;', |
161 const [ | 156 const [ |
162 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, | 157 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, |
163 receiver: 'p.C', name: 'o'), | 158 receiver: 'p.C', name: 'o'), |
164 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'C'), | 159 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'C'), |
165 ]), | 160 ]), |
166 const Test.prefix( | 161 const Test.prefix( |
167 ''' | 162 ''' |
168 class C { | 163 class C { |
169 } | 164 } |
170 ''', | 165 ''', |
171 'm() => p.C.o;', | 166 'm() => p.C.o;', |
172 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), | 167 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), |
173 const Test.prefix( | 168 const Test.prefix( |
174 ''' | 169 ''' |
175 ''', | 170 ''', |
176 'm() => p.C.o;', | 171 'm() => p.C.o;', |
177 const [ | 172 const [ |
178 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, | 173 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, |
179 receiver: 'p.C', name: 'o'), | 174 receiver: 'p.C', name: 'o'), |
180 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 175 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
181 element: 'prefix(p)'), | 176 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'C'), |
182 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | |
183 name: 'C'), | |
184 ], | 177 ], |
185 isDeferred: true), | 178 isDeferred: true), |
186 const Test.prefix( | 179 const Test.prefix( |
187 ''' | 180 ''' |
188 class C { | 181 class C { |
189 } | 182 } |
190 ''', | 183 ''', |
191 'm() => p.C.o;', | 184 'm() => p.C.o;', |
192 const [ | 185 const [ |
193 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 186 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
194 element: 'prefix(p)'), | 187 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o'), |
195 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | |
196 name: 'o'), | |
197 ], | 188 ], |
198 isDeferred: true), | 189 isDeferred: true), |
199 const Test( | 190 const Test( |
200 ''' | 191 ''' |
201 class C {} | 192 class C {} |
202 m() => C.this; | 193 m() => C.this; |
203 ''', | 194 ''', |
204 null), | 195 null), |
205 const Test( | 196 const Test( |
206 ''' | 197 ''' |
207 class C { | 198 class C { |
208 static var o; | 199 static var o; |
209 } | 200 } |
210 m() { C.o = 42; } | 201 m() { C.o = 42; } |
211 ''', | 202 ''', |
212 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, | 203 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, |
213 element: 'field(C#o)', | 204 element: 'field(C#o)', rhs: '42')), |
214 rhs: '42')), | |
215 const Test.clazz( | 205 const Test.clazz( |
216 ''' | 206 ''' |
217 class C { | 207 class C { |
218 static var o; | 208 static var o; |
219 m() { o = 42; } | 209 m() { o = 42; } |
220 } | 210 } |
221 ''', | 211 ''', |
222 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, | 212 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, |
223 element: 'field(C#o)', | 213 element: 'field(C#o)', rhs: '42')), |
224 rhs: '42')), | |
225 const Test.clazz( | 214 const Test.clazz( |
226 ''' | 215 ''' |
227 class C { | 216 class C { |
228 static var o; | 217 static var o; |
229 m() { C.o = 42; } | 218 m() { C.o = 42; } |
230 } | 219 } |
231 ''', | 220 ''', |
232 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, | 221 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, |
233 element: 'field(C#o)', | 222 element: 'field(C#o)', rhs: '42')), |
234 rhs: '42')), | |
235 const Test.prefix( | 223 const Test.prefix( |
236 ''' | 224 ''' |
237 class C { | 225 class C { |
238 static var o; | 226 static var o; |
239 } | 227 } |
240 ''', | 228 ''', |
241 'm() { p.C.o = 42; }', | 229 'm() { p.C.o = 42; }', |
242 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, | 230 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, |
243 element: 'field(C#o)', | 231 element: 'field(C#o)', rhs: '42')), |
244 rhs: '42')), | |
245 const Test.clazz( | 232 const Test.clazz( |
246 ''' | 233 ''' |
247 class C { | 234 class C { |
248 var o; | 235 var o; |
249 static m() { o = 42; } | 236 static m() { o = 42; } |
250 } | 237 } |
251 ''', | 238 ''', |
252 const Visit(VisitKind.ERROR_INVALID_SET, | 239 const Visit(VisitKind.ERROR_INVALID_SET, |
253 error: MessageKind.NO_INSTANCE_AVAILABLE, | 240 error: MessageKind.NO_INSTANCE_AVAILABLE, rhs: '42')), |
254 rhs: '42')), | |
255 const Test( | 241 const Test( |
256 ''' | 242 ''' |
257 class C { | 243 class C { |
258 static var o; | 244 static var o; |
259 } | 245 } |
260 m() { C.o(null, 42); } | 246 m() { C.o(null, 42); } |
261 ''', | 247 ''', |
262 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, | 248 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, |
263 element: 'field(C#o)', | 249 element: 'field(C#o)', arguments: '(null,42)')), |
264 arguments: '(null,42)')), | |
265 const Test.clazz( | 250 const Test.clazz( |
266 ''' | 251 ''' |
267 class C { | 252 class C { |
268 static var o; | 253 static var o; |
269 m() { o(null, 42); } | 254 m() { o(null, 42); } |
270 } | 255 } |
271 ''', | 256 ''', |
272 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, | 257 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, |
273 element: 'field(C#o)', | 258 element: 'field(C#o)', arguments: '(null,42)')), |
274 arguments: '(null,42)')), | |
275 const Test.clazz( | 259 const Test.clazz( |
276 ''' | 260 ''' |
277 class C { | 261 class C { |
278 static var o; | 262 static var o; |
279 m() { C.o(null, 42); } | 263 m() { C.o(null, 42); } |
280 } | 264 } |
281 ''', | 265 ''', |
282 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, | 266 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, |
283 element: 'field(C#o)', | 267 element: 'field(C#o)', arguments: '(null,42)')), |
284 arguments: '(null,42)')), | |
285 const Test.clazz( | 268 const Test.clazz( |
286 ''' | 269 ''' |
287 class C { | 270 class C { |
288 var o; | 271 var o; |
289 static m() { o(null, 42); } | 272 static m() { o(null, 42); } |
290 } | 273 } |
291 ''', | 274 ''', |
292 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 275 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
293 error: MessageKind.NO_INSTANCE_AVAILABLE, | 276 error: MessageKind.NO_INSTANCE_AVAILABLE, arguments: '(null,42)')), |
294 arguments: '(null,42)')), | |
295 const Test.prefix( | 277 const Test.prefix( |
296 ''' | 278 ''' |
297 class C { | 279 class C { |
298 static var o; | 280 static var o; |
299 } | 281 } |
300 ''', | 282 ''', |
301 'm() { p.C.o(null, 42); }', | 283 'm() { p.C.o(null, 42); }', |
302 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, | 284 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, |
303 element: 'field(C#o)', | 285 element: 'field(C#o)', arguments: '(null,42)')), |
304 arguments: '(null,42)')), | |
305 const Test( | 286 const Test( |
306 ''' | 287 ''' |
307 class C {} | 288 class C {} |
308 m() => C.this(null, 42); | 289 m() => C.this(null, 42); |
309 ''', | 290 ''', |
310 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 291 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
311 error: MessageKind.THIS_PROPERTY, | 292 error: MessageKind.THIS_PROPERTY, arguments: '(null,42)')), |
312 arguments: '(null,42)')), | |
313 const Test( | 293 const Test( |
314 ''' | 294 ''' |
315 class C { static final o = 0; } | 295 class C { static final o = 0; } |
316 m() { C.o = 42; } | 296 m() { C.o = 42; } |
317 ''', | 297 ''', |
318 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 298 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
319 element: 'field(C#o)', | 299 element: 'field(C#o)', rhs: '42')), |
320 rhs: '42')), | |
321 const Test.clazz( | 300 const Test.clazz( |
322 ''' | 301 ''' |
323 class C { | 302 class C { |
324 static final o = 0; | 303 static final o = 0; |
325 m() { o = 42; } | 304 m() { o = 42; } |
326 } | 305 } |
327 ''', | 306 ''', |
328 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 307 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
329 element: 'field(C#o)', | 308 element: 'field(C#o)', rhs: '42')), |
330 rhs: '42')), | |
331 const Test.clazz( | 309 const Test.clazz( |
332 ''' | 310 ''' |
333 class C { | 311 class C { |
334 static final o = 0; | 312 static final o = 0; |
335 m() { C.o = 42; } | 313 m() { C.o = 42; } |
336 } | 314 } |
337 ''', | 315 ''', |
338 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 316 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
339 element: 'field(C#o)', | 317 element: 'field(C#o)', rhs: '42')), |
340 rhs: '42')), | |
341 const Test.prefix( | 318 const Test.prefix( |
342 ''' | 319 ''' |
343 class C { | 320 class C { |
344 static final o = 0; | 321 static final o = 0; |
345 } | 322 } |
346 ''', | 323 ''', |
347 'm() { p.C.o = 42; }', | 324 'm() { p.C.o = 42; }', |
348 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 325 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
349 element: 'field(C#o)', | 326 element: 'field(C#o)', rhs: '42')), |
350 rhs: '42')), | |
351 const Test( | 327 const Test( |
352 ''' | 328 ''' |
353 class C { static const o = 0; } | 329 class C { static const o = 0; } |
354 m() { C.o = 42; } | 330 m() { C.o = 42; } |
355 ''', | 331 ''', |
356 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 332 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
357 element: 'field(C#o)', | 333 element: 'field(C#o)', rhs: '42')), |
358 rhs: '42')), | |
359 const Test.clazz( | 334 const Test.clazz( |
360 ''' | 335 ''' |
361 class C { | 336 class C { |
362 static const o = 0; | 337 static const o = 0; |
363 m() { o = 42; } | 338 m() { o = 42; } |
364 } | 339 } |
365 ''', | 340 ''', |
366 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 341 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
367 element: 'field(C#o)', | 342 element: 'field(C#o)', rhs: '42')), |
368 rhs: '42')), | |
369 const Test.clazz( | 343 const Test.clazz( |
370 ''' | 344 ''' |
371 class C { | 345 class C { |
372 static const o = 0; | 346 static const o = 0; |
373 m() { C.o = 42; } | 347 m() { C.o = 42; } |
374 } | 348 } |
375 ''', | 349 ''', |
376 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 350 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
377 element: 'field(C#o)', | 351 element: 'field(C#o)', rhs: '42')), |
378 rhs: '42')), | |
379 const Test.prefix( | 352 const Test.prefix( |
380 ''' | 353 ''' |
381 class C { | 354 class C { |
382 static const o = 0; | 355 static const o = 0; |
383 } | 356 } |
384 ''', | 357 ''', |
385 'm() { p.C.o = 42; }', | 358 'm() { p.C.o = 42; }', |
386 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, | 359 const Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET, |
387 element: 'field(C#o)', | 360 element: 'field(C#o)', rhs: '42')), |
388 rhs: '42')), | |
389 ], | 361 ], |
390 'Static properties': const [ | 362 'Static properties': const [ |
391 // Static properties | 363 // Static properties |
392 const Test( | 364 const Test( |
393 ''' | 365 ''' |
394 class C { | 366 class C { |
395 static get o => null; | 367 static get o => null; |
396 } | 368 } |
397 m() => C.o; | 369 m() => C.o; |
398 ''', | 370 ''', |
399 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, | 371 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, element: 'getter(C#o)')), |
400 element: 'getter(C#o)')), | |
401 const Test.clazz( | 372 const Test.clazz( |
402 ''' | 373 ''' |
403 class C { | 374 class C { |
404 static get o => null; | 375 static get o => null; |
405 m() => o; | 376 m() => o; |
406 } | 377 } |
407 ''', | 378 ''', |
408 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, | 379 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, element: 'getter(C#o)')), |
409 element: 'getter(C#o)')), | |
410 const Test.clazz( | 380 const Test.clazz( |
411 ''' | 381 ''' |
412 class C { | 382 class C { |
413 static get o => null; | 383 static get o => null; |
414 m() => C.o; | 384 m() => C.o; |
415 } | 385 } |
416 ''', | 386 ''', |
417 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, | 387 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, element: 'getter(C#o)')), |
418 element: 'getter(C#o)')), | |
419 const Test.prefix( | 388 const Test.prefix( |
420 ''' | 389 ''' |
421 class C { | 390 class C { |
422 static get o => null; | 391 static get o => null; |
423 } | 392 } |
424 ''', | 393 ''', |
425 'm() => p.C.o;', | 394 'm() => p.C.o;', |
426 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, | 395 const Visit(VisitKind.VISIT_STATIC_GETTER_GET, element: 'getter(C#o)')), |
427 element: 'getter(C#o)')), | |
428 const Test( | 396 const Test( |
429 ''' | 397 ''' |
430 class C { static get o => 42; } | 398 class C { static get o => 42; } |
431 m() { C.o = 42; } | 399 m() { C.o = 42; } |
432 ''', | 400 ''', |
433 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, | 401 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, |
434 element: 'getter(C#o)', | 402 element: 'getter(C#o)', rhs: '42')), |
435 rhs: '42')), | |
436 const Test.clazz( | 403 const Test.clazz( |
437 ''' | 404 ''' |
438 class C { | 405 class C { |
439 static get o => 42; | 406 static get o => 42; |
440 m() { o = 42; } | 407 m() { o = 42; } |
441 } | 408 } |
442 ''', | 409 ''', |
443 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, | 410 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, |
444 element: 'getter(C#o)', | 411 element: 'getter(C#o)', rhs: '42')), |
445 rhs: '42')), | |
446 const Test.clazz( | 412 const Test.clazz( |
447 ''' | 413 ''' |
448 class C { | 414 class C { |
449 static get o => 42; | 415 static get o => 42; |
450 m() { C.o = 42; } | 416 m() { C.o = 42; } |
451 } | 417 } |
452 ''', | 418 ''', |
453 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, | 419 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, |
454 element: 'getter(C#o)', | 420 element: 'getter(C#o)', rhs: '42')), |
455 rhs: '42')), | |
456 const Test.prefix( | 421 const Test.prefix( |
457 ''' | 422 ''' |
458 class C { | 423 class C { |
459 static get o => 42; | 424 static get o => 42; |
460 } | 425 } |
461 ''', | 426 ''', |
462 'm() { p.C.o = 42; }', | 427 'm() { p.C.o = 42; }', |
463 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, | 428 const Visit(VisitKind.VISIT_STATIC_GETTER_SET, |
464 element: 'getter(C#o)', | 429 element: 'getter(C#o)', rhs: '42')), |
465 rhs: '42')), | |
466 const Test( | 430 const Test( |
467 ''' | 431 ''' |
468 class C { | 432 class C { |
469 static set o(_) {} | 433 static set o(_) {} |
470 } | 434 } |
471 m() => C.o; | 435 m() => C.o; |
472 ''', | 436 ''', |
473 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, | 437 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, element: 'setter(C#o)')), |
474 element: 'setter(C#o)')), | |
475 const Test.clazz( | 438 const Test.clazz( |
476 ''' | 439 ''' |
477 class C { | 440 class C { |
478 static set o(_) {} | 441 static set o(_) {} |
479 m() => o; | 442 m() => o; |
480 } | 443 } |
481 ''', | 444 ''', |
482 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, | 445 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, element: 'setter(C#o)')), |
483 element: 'setter(C#o)')), | |
484 | 446 |
485 const Test.clazz( | 447 const Test.clazz( |
486 ''' | 448 ''' |
487 class C { | 449 class C { |
488 static set o(_) {} | 450 static set o(_) {} |
489 m() => C.o; | 451 m() => C.o; |
490 } | 452 } |
491 ''', | 453 ''', |
492 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, | 454 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, element: 'setter(C#o)')), |
493 element: 'setter(C#o)')), | |
494 const Test.prefix( | 455 const Test.prefix( |
495 ''' | 456 ''' |
496 class C { | 457 class C { |
497 static set o(_) {} | 458 static set o(_) {} |
498 } | 459 } |
499 ''', | 460 ''', |
500 'm() => p.C.o;', | 461 'm() => p.C.o;', |
501 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, | 462 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, element: 'setter(C#o)')), |
502 element: 'setter(C#o)')), | |
503 const Test( | 463 const Test( |
504 ''' | 464 ''' |
505 class C { static set o(_) {} } | 465 class C { static set o(_) {} } |
506 m() { C.o = 42; } | 466 m() { C.o = 42; } |
507 ''', | 467 ''', |
508 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, | 468 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, |
509 element: 'setter(C#o)', | 469 element: 'setter(C#o)', rhs: '42')), |
510 rhs: '42')), | |
511 const Test.clazz( | 470 const Test.clazz( |
512 ''' | 471 ''' |
513 class C { | 472 class C { |
514 static set o(_) {} | 473 static set o(_) {} |
515 m() { o = 42; } | 474 m() { o = 42; } |
516 } | 475 } |
517 ''', | 476 ''', |
518 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, | 477 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, |
519 element: 'setter(C#o)', | 478 element: 'setter(C#o)', rhs: '42')), |
520 rhs: '42')), | |
521 const Test.clazz( | 479 const Test.clazz( |
522 ''' | 480 ''' |
523 class C { | 481 class C { |
524 static set o(_) {} | 482 static set o(_) {} |
525 m() { C.o = 42; } | 483 m() { C.o = 42; } |
526 } | 484 } |
527 ''', | 485 ''', |
528 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, | 486 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, |
529 element: 'setter(C#o)', | 487 element: 'setter(C#o)', rhs: '42')), |
530 rhs: '42')), | |
531 const Test.prefix( | 488 const Test.prefix( |
532 ''' | 489 ''' |
533 class C { | 490 class C { |
534 static set o(_) {} | 491 static set o(_) {} |
535 } | 492 } |
536 ''', | 493 ''', |
537 'm() { p.C.o = 42; }', | 494 'm() { p.C.o = 42; }', |
538 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, | 495 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, |
539 element: 'setter(C#o)', | 496 element: 'setter(C#o)', rhs: '42')), |
540 rhs: '42')), | |
541 const Test( | 497 const Test( |
542 ''' | 498 ''' |
543 class C { static get o => null; } | 499 class C { static get o => null; } |
544 m() => C.o(null, 42); | 500 m() => C.o(null, 42); |
545 ''', | 501 ''', |
546 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, | 502 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, |
547 element: 'getter(C#o)', | 503 element: 'getter(C#o)', arguments: '(null,42)')), |
548 arguments: '(null,42)')), | |
549 const Test.clazz( | 504 const Test.clazz( |
550 ''' | 505 ''' |
551 class C { | 506 class C { |
552 static get o => null; | 507 static get o => null; |
553 m() { o(null, 42); } | 508 m() { o(null, 42); } |
554 } | 509 } |
555 ''', | 510 ''', |
556 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, | 511 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, |
557 element: 'getter(C#o)', | 512 element: 'getter(C#o)', arguments: '(null,42)')), |
558 arguments: '(null,42)')), | |
559 const Test.clazz( | 513 const Test.clazz( |
560 ''' | 514 ''' |
561 class C { | 515 class C { |
562 static get o => null; | 516 static get o => null; |
563 m() { C.o(null, 42); } | 517 m() { C.o(null, 42); } |
564 } | 518 } |
565 ''', | 519 ''', |
566 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, | 520 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, |
567 element: 'getter(C#o)', | 521 element: 'getter(C#o)', arguments: '(null,42)')), |
568 arguments: '(null,42)')), | |
569 const Test.prefix( | 522 const Test.prefix( |
570 ''' | 523 ''' |
571 class C { | 524 class C { |
572 static get o => null; | 525 static get o => null; |
573 } | 526 } |
574 ''', | 527 ''', |
575 'm() { p.C.o(null, 42); }', | 528 'm() { p.C.o(null, 42); }', |
576 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, | 529 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, |
577 element: 'getter(C#o)', | 530 element: 'getter(C#o)', arguments: '(null,42)')), |
578 arguments: '(null,42)')), | |
579 const Test( | 531 const Test( |
580 ''' | 532 ''' |
581 class C { static set o(_) {} } | 533 class C { static set o(_) {} } |
582 m() => C.o(null, 42); | 534 m() => C.o(null, 42); |
583 ''', | 535 ''', |
584 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, | 536 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, |
585 element: 'setter(C#o)', | 537 element: 'setter(C#o)', arguments: '(null,42)')), |
586 arguments: '(null,42)')), | |
587 const Test.clazz( | 538 const Test.clazz( |
588 ''' | 539 ''' |
589 class C { | 540 class C { |
590 static set o(_) {} | 541 static set o(_) {} |
591 m() { o(null, 42); } | 542 m() { o(null, 42); } |
592 } | 543 } |
593 ''', | 544 ''', |
594 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, | 545 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, |
595 element: 'setter(C#o)', | 546 element: 'setter(C#o)', arguments: '(null,42)')), |
596 arguments: '(null,42)')), | |
597 const Test.clazz( | 547 const Test.clazz( |
598 ''' | 548 ''' |
599 class C { | 549 class C { |
600 static set o(_) {} | 550 static set o(_) {} |
601 m() { C.o(null, 42); } | 551 m() { C.o(null, 42); } |
602 } | 552 } |
603 ''', | 553 ''', |
604 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, | 554 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, |
605 element: 'setter(C#o)', | 555 element: 'setter(C#o)', arguments: '(null,42)')), |
606 arguments: '(null,42)')), | |
607 const Test.prefix( | 556 const Test.prefix( |
608 ''' | 557 ''' |
609 class C { | 558 class C { |
610 static set o(_) {} | 559 static set o(_) {} |
611 } | 560 } |
612 ''', | 561 ''', |
613 'm() { p.C.o(null, 42); }', | 562 'm() { p.C.o(null, 42); }', |
614 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, | 563 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, |
615 element: 'setter(C#o)', | 564 element: 'setter(C#o)', arguments: '(null,42)')), |
616 arguments: '(null,42)')), | |
617 ], | 565 ], |
618 'Static functions': const [ | 566 'Static functions': const [ |
619 // Static functions | 567 // Static functions |
620 const Test( | 568 const Test( |
621 ''' | 569 ''' |
622 class C { static o(a, b) {} } | 570 class C { static o(a, b) {} } |
623 m() => C.o; | 571 m() => C.o; |
624 ''', | 572 ''', |
625 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, | 573 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, |
626 element: 'function(C#o)')), | 574 element: 'function(C#o)')), |
627 const Test.clazz( | 575 const Test.clazz( |
628 ''' | 576 ''' |
629 class C { | 577 class C { |
630 static o(a, b) {} | 578 static o(a, b) {} |
631 m() => o; | 579 m() => o; |
632 } | 580 } |
633 ''', | 581 ''', |
634 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, | 582 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, |
635 element: 'function(C#o)')), | 583 element: 'function(C#o)')), |
636 const Test.clazz( | 584 const Test.clazz( |
637 ''' | 585 ''' |
638 class C { | 586 class C { |
639 static o(a, b) {} | 587 static o(a, b) {} |
640 m() => C.o; | 588 m() => C.o; |
641 } | 589 } |
642 ''', | 590 ''', |
643 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, | 591 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, |
644 element: 'function(C#o)')), | 592 element: 'function(C#o)')), |
645 const Test.prefix( | 593 const Test.prefix( |
646 ''' | 594 ''' |
647 class C { static o(a, b) {} } | 595 class C { static o(a, b) {} } |
648 ''', | 596 ''', |
649 ''' | 597 ''' |
650 m() => p.C.o; | 598 m() => p.C.o; |
651 ''', | 599 ''', |
652 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, | 600 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, |
653 element: 'function(C#o)')), | 601 element: 'function(C#o)')), |
654 const Test( | 602 const Test( |
655 ''' | 603 ''' |
656 class C { static o(a, b) {} } | 604 class C { static o(a, b) {} } |
657 m() { C.o = 42; } | 605 m() { C.o = 42; } |
658 ''', | 606 ''', |
659 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, | 607 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, |
660 element: 'function(C#o)', | 608 element: 'function(C#o)', rhs: '42')), |
661 rhs: '42')), | |
662 const Test.clazz( | 609 const Test.clazz( |
663 ''' | 610 ''' |
664 class C { | 611 class C { |
665 static o(a, b) {} | 612 static o(a, b) {} |
666 m() { o = 42; } | 613 m() { o = 42; } |
667 } | 614 } |
668 ''', | 615 ''', |
669 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, | 616 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, |
670 element: 'function(C#o)', | 617 element: 'function(C#o)', rhs: '42')), |
671 rhs: '42')), | |
672 const Test.clazz( | 618 const Test.clazz( |
673 ''' | 619 ''' |
674 class C { | 620 class C { |
675 static o(a, b) {} | 621 static o(a, b) {} |
676 m() { C.o = 42; } | 622 m() { C.o = 42; } |
677 } | 623 } |
678 ''', | 624 ''', |
679 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, | 625 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, |
680 element: 'function(C#o)', | 626 element: 'function(C#o)', rhs: '42')), |
681 rhs: '42')), | |
682 const Test.prefix( | 627 const Test.prefix( |
683 ''' | 628 ''' |
684 class C { static o(a, b) {} } | 629 class C { static o(a, b) {} } |
685 ''', | 630 ''', |
686 ''' | 631 ''' |
687 m() { p.C.o = 42; } | 632 m() { p.C.o = 42; } |
688 ''', | 633 ''', |
689 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, | 634 const Visit(VisitKind.VISIT_STATIC_FUNCTION_SET, |
690 element: 'function(C#o)', | 635 element: 'function(C#o)', rhs: '42')), |
691 rhs: '42')), | |
692 const Test( | 636 const Test( |
693 ''' | 637 ''' |
694 class C { static o(a, b) {} } | 638 class C { static o(a, b) {} } |
695 m() => C.o(null, 42); | 639 m() => C.o(null, 42); |
696 ''', | 640 ''', |
697 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, | 641 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, |
698 element: 'function(C#o)', | 642 element: 'function(C#o)', arguments: '(null,42)')), |
699 arguments: '(null,42)')), | |
700 const Test.clazz( | 643 const Test.clazz( |
701 ''' | 644 ''' |
702 class C { | 645 class C { |
703 static o(a, b) {} | 646 static o(a, b) {} |
704 m() { o(null, 42); } | 647 m() { o(null, 42); } |
705 } | 648 } |
706 ''', | 649 ''', |
707 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, | 650 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, |
708 element: 'function(C#o)', | 651 element: 'function(C#o)', arguments: '(null,42)')), |
709 arguments: '(null,42)')), | |
710 const Test.clazz( | 652 const Test.clazz( |
711 ''' | 653 ''' |
712 class C { | 654 class C { |
713 static o(a, b) {} | 655 static o(a, b) {} |
714 m() { C.o(null, 42); } | 656 m() { C.o(null, 42); } |
715 } | 657 } |
716 ''', | 658 ''', |
717 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, | 659 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, |
718 element: 'function(C#o)', | 660 element: 'function(C#o)', arguments: '(null,42)')), |
719 arguments: '(null,42)')), | |
720 const Test.prefix( | 661 const Test.prefix( |
721 ''' | 662 ''' |
722 class C { | 663 class C { |
723 static o(a, b) {} | 664 static o(a, b) {} |
724 } | 665 } |
725 ''', | 666 ''', |
726 'm() { p.C.o(null, 42); }', | 667 'm() { p.C.o(null, 42); }', |
727 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, | 668 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE, |
728 element: 'function(C#o)', | 669 element: 'function(C#o)', arguments: '(null,42)')), |
729 arguments: '(null,42)')), | |
730 const Test( | 670 const Test( |
731 ''' | 671 ''' |
732 class C { static o(a, b) {} } | 672 class C { static o(a, b) {} } |
733 m() => C.o(null); | 673 m() => C.o(null); |
734 ''', | 674 ''', |
735 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE, | 675 const Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE, |
736 element: 'function(C#o)', | 676 element: 'function(C#o)', arguments: '(null)')), |
737 arguments: '(null)')), | |
738 ], | 677 ], |
739 'Top level fields': const [ | 678 'Top level fields': const [ |
740 // Top level fields | 679 // Top level fields |
741 const Test( | 680 const Test( |
742 ''' | 681 ''' |
743 var o; | 682 var o; |
744 m() => o; | 683 m() => o; |
745 ''', | 684 ''', |
746 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, | 685 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, element: 'field(o)')), |
747 element: 'field(o)')), | |
748 const Test.prefix( | 686 const Test.prefix( |
749 ''' | 687 ''' |
750 var o; | 688 var o; |
751 ''', | 689 ''', |
752 'm() => p.o;', | 690 'm() => p.o;', |
753 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, | 691 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, element: 'field(o)')), |
754 element: 'field(o)')), | |
755 const Test.prefix( | 692 const Test.prefix( |
756 ''' | 693 ''' |
757 var o; | 694 var o; |
758 ''', | 695 ''', |
759 'm() => p.o;', | 696 'm() => p.o;', |
760 const [ | 697 const [ |
761 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 698 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
762 element: 'prefix(p)'), | 699 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, element: 'field(o)'), |
763 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, | |
764 element: 'field(o)'), | |
765 ], | 700 ], |
766 isDeferred: true), | 701 isDeferred: true), |
767 const Test.prefix( | 702 const Test.prefix( |
768 ''' | 703 ''' |
769 ''', | 704 ''', |
770 'm() => p.o;', | 705 'm() => p.o;', |
771 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | 706 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), |
772 name: 'o')), | |
773 const Test.prefix( | 707 const Test.prefix( |
774 ''' | 708 ''' |
775 ''', | 709 ''', |
776 'm() => p.o;', | 710 'm() => p.o;', |
777 const [ | 711 const [ |
778 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 712 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
779 element: 'prefix(p)'), | 713 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o'), |
780 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | |
781 name: 'o'), | |
782 ], | 714 ], |
783 isDeferred: true), | 715 isDeferred: true), |
784 const Test.prefix( | 716 const Test.prefix( |
785 ''' | 717 ''' |
786 ''', | 718 ''', |
787 'm() => p;', | 719 'm() => p;', |
788 const Visit(VisitKind.ERROR_INVALID_GET, | 720 const Visit(VisitKind.ERROR_INVALID_GET, |
789 error: MessageKind.PREFIX_AS_EXPRESSION)), | 721 error: MessageKind.PREFIX_AS_EXPRESSION)), |
790 const Test( | 722 const Test( |
791 ''' | 723 ''' |
792 var o; | 724 var o; |
793 m() { o = 42; } | 725 m() { o = 42; } |
794 ''', | 726 ''', |
795 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, | 727 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, |
796 element: 'field(o)', | 728 element: 'field(o)', rhs: '42')), |
797 rhs: '42')), | |
798 const Test.prefix( | 729 const Test.prefix( |
799 ''' | 730 ''' |
800 var o; | 731 var o; |
801 ''', | 732 ''', |
802 'm() { p.o = 42; }', | 733 'm() { p.o = 42; }', |
803 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, | 734 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET, |
804 element: 'field(o)', | 735 element: 'field(o)', rhs: '42')), |
805 rhs: '42')), | |
806 const Test.prefix( | 736 const Test.prefix( |
807 ''' | 737 ''' |
808 ''', | 738 ''', |
809 'm() { p = 42; }', | 739 'm() { p = 42; }', |
810 const Visit(VisitKind.ERROR_INVALID_SET, | 740 const Visit(VisitKind.ERROR_INVALID_SET, |
811 error: MessageKind.PREFIX_AS_EXPRESSION, | 741 error: MessageKind.PREFIX_AS_EXPRESSION, rhs: '42')), |
812 rhs: '42')), | |
813 const Test( | 742 const Test( |
814 ''' | 743 ''' |
815 final o = 0; | 744 final o = 0; |
816 m() { o = 42; } | 745 m() { o = 42; } |
817 ''', | 746 ''', |
818 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 747 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
819 element: 'field(o)', | 748 element: 'field(o)', rhs: '42')), |
820 rhs: '42')), | |
821 const Test.prefix( | 749 const Test.prefix( |
822 ''' | 750 ''' |
823 final o = 0; | 751 final o = 0; |
824 ''', | 752 ''', |
825 'm() { p.o = 42; }', | 753 'm() { p.o = 42; }', |
826 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 754 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
827 element: 'field(o)', | 755 element: 'field(o)', rhs: '42')), |
828 rhs: '42')), | |
829 const Test( | 756 const Test( |
830 ''' | 757 ''' |
831 const o = 0; | 758 const o = 0; |
832 m() { o = 42; } | 759 m() { o = 42; } |
833 ''', | 760 ''', |
834 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 761 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
835 element: 'field(o)', | 762 element: 'field(o)', rhs: '42')), |
836 rhs: '42')), | |
837 const Test.prefix( | 763 const Test.prefix( |
838 ''' | 764 ''' |
839 const o = 0; | 765 const o = 0; |
840 ''', | 766 ''', |
841 'm() { p.o = 42; }', | 767 'm() { p.o = 42; }', |
842 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, | 768 const Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET, |
843 element: 'field(o)', | 769 element: 'field(o)', rhs: '42')), |
844 rhs: '42')), | |
845 const Test( | 770 const Test( |
846 ''' | 771 ''' |
847 var o; | 772 var o; |
848 m() { o(null, 42); } | 773 m() { o(null, 42); } |
849 ''', | 774 ''', |
850 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, | 775 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, |
851 element: 'field(o)', | 776 element: 'field(o)', arguments: '(null,42)')), |
852 arguments: '(null,42)')), | |
853 const Test.prefix( | 777 const Test.prefix( |
854 ''' | 778 ''' |
855 var o; | 779 var o; |
856 ''', | 780 ''', |
857 'm() { p.o(null, 42); }', | 781 'm() { p.o(null, 42); }', |
858 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, | 782 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE, |
859 element: 'field(o)', | 783 element: 'field(o)', arguments: '(null,42)')), |
860 arguments: '(null,42)')), | |
861 const Test.prefix( | 784 const Test.prefix( |
862 ''' | 785 ''' |
863 ''', | 786 ''', |
864 'm() { p(null, 42); }', | 787 'm() { p(null, 42); }', |
865 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 788 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
866 error: MessageKind.PREFIX_AS_EXPRESSION, | 789 error: MessageKind.PREFIX_AS_EXPRESSION, arguments: '(null,42)')), |
867 arguments: '(null,42)')), | |
868 const Test( | 790 const Test( |
869 ''' | 791 ''' |
870 m() => o; | 792 m() => o; |
871 ''', | 793 ''', |
872 const Visit(VisitKind.VISIT_UNRESOLVED_GET, | 794 const Visit(VisitKind.VISIT_UNRESOLVED_GET, name: 'o')), |
873 name: 'o')), | |
874 const Test( | 795 const Test( |
875 ''' | 796 ''' |
876 m() { o = 42; } | 797 m() { o = 42; } |
877 ''', | 798 ''', |
878 const Visit(VisitKind.VISIT_UNRESOLVED_SET, | 799 const Visit(VisitKind.VISIT_UNRESOLVED_SET, name: 'o', rhs: '42')), |
879 name: 'o', | |
880 rhs: '42')), | |
881 ], | 800 ], |
882 'Top level properties': const [ | 801 'Top level properties': const [ |
883 // Top level properties | 802 // Top level properties |
884 const Test( | 803 const Test( |
885 ''' | 804 ''' |
886 get o => null; | 805 get o => null; |
887 m() => o; | 806 m() => o; |
888 ''', | 807 ''', |
889 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET, | 808 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET, |
890 element: 'getter(o)')), | 809 element: 'getter(o)')), |
891 const Test.prefix( | 810 const Test.prefix( |
892 ''' | 811 ''' |
893 get o => null; | 812 get o => null; |
894 ''', | 813 ''', |
895 ''' | 814 ''' |
896 m() => p.o; | 815 m() => p.o; |
897 ''', | 816 ''', |
898 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET, | 817 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET, |
899 element: 'getter(o)')), | 818 element: 'getter(o)')), |
900 const Test( | 819 const Test( |
901 ''' | 820 ''' |
902 set o(_) {} | 821 set o(_) {} |
903 m() => o; | 822 m() => o; |
904 ''', | 823 ''', |
905 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET, | 824 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET, |
906 element: 'setter(o)')), | 825 element: 'setter(o)')), |
907 const Test.prefix( | 826 const Test.prefix( |
908 ''' | 827 ''' |
909 set o(_) {} | 828 set o(_) {} |
910 ''', | 829 ''', |
911 ''' | 830 ''' |
912 m() => p.o; | 831 m() => p.o; |
913 ''', | 832 ''', |
914 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET, | 833 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET, |
915 element: 'setter(o)')), | 834 element: 'setter(o)')), |
916 const Test( | 835 const Test( |
917 ''' | 836 ''' |
918 get o => null; | 837 get o => null; |
919 m() { o = 42; } | 838 m() { o = 42; } |
920 ''', | 839 ''', |
921 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET, | 840 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET, |
922 element: 'getter(o)', | 841 element: 'getter(o)', rhs: '42')), |
923 rhs: '42')), | |
924 const Test.prefix( | 842 const Test.prefix( |
925 ''' | 843 ''' |
926 get o => null; | 844 get o => null; |
927 ''', | 845 ''', |
928 'm() { p.o = 42; }', | 846 'm() { p.o = 42; }', |
929 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET, | 847 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET, |
930 element: 'getter(o)', | 848 element: 'getter(o)', rhs: '42')), |
931 rhs: '42')), | |
932 const Test( | 849 const Test( |
933 ''' | 850 ''' |
934 set o(_) {} | 851 set o(_) {} |
935 m() { o = 42; } | 852 m() { o = 42; } |
936 ''', | 853 ''', |
937 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET, | 854 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET, |
938 element: 'setter(o)', | 855 element: 'setter(o)', rhs: '42')), |
939 rhs: '42')), | |
940 const Test.prefix( | 856 const Test.prefix( |
941 ''' | 857 ''' |
942 set o(_) {} | 858 set o(_) {} |
943 ''', | 859 ''', |
944 'm() { p.o = 42; }', | 860 'm() { p.o = 42; }', |
945 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET, | 861 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET, |
946 element: 'setter(o)', | 862 element: 'setter(o)', rhs: '42')), |
947 rhs: '42')), | |
948 const Test( | 863 const Test( |
949 ''' | 864 ''' |
950 get o => null; | 865 get o => null; |
951 m() => o(null, 42); | 866 m() => o(null, 42); |
952 ''', | 867 ''', |
953 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE, | 868 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE, |
954 element: 'getter(o)', | 869 element: 'getter(o)', arguments: '(null,42)')), |
955 arguments: '(null,42)')), | |
956 const Test.prefix( | 870 const Test.prefix( |
957 ''' | 871 ''' |
958 get o => null; | 872 get o => null; |
959 ''', | 873 ''', |
960 'm() { p.o(null, 42); }', | 874 'm() { p.o(null, 42); }', |
961 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE, | 875 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE, |
962 element: 'getter(o)', | 876 element: 'getter(o)', arguments: '(null,42)')), |
963 arguments: '(null,42)')), | |
964 const Test( | 877 const Test( |
965 ''' | 878 ''' |
966 set o(_) {} | 879 set o(_) {} |
967 m() => o(null, 42); | 880 m() => o(null, 42); |
968 ''', | 881 ''', |
969 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, | 882 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, |
970 element: 'setter(o)', | 883 element: 'setter(o)', arguments: '(null,42)')), |
971 arguments: '(null,42)')), | |
972 const Test.prefix( | 884 const Test.prefix( |
973 ''' | 885 ''' |
974 set o(_) {} | 886 set o(_) {} |
975 ''', | 887 ''', |
976 'm() { p.o(null, 42); }', | 888 'm() { p.o(null, 42); }', |
977 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, | 889 const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE, |
978 element: 'setter(o)', | 890 element: 'setter(o)', arguments: '(null,42)')), |
979 arguments: '(null,42)')), | |
980 ], | 891 ], |
981 'Top level functions': const [ | 892 'Top level functions': const [ |
982 // Top level functions | 893 // Top level functions |
983 const Test( | 894 const Test( |
984 ''' | 895 ''' |
985 o(a, b) {} | 896 o(a, b) {} |
986 m() => o; | 897 m() => o; |
987 ''', | 898 ''', |
988 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET, | 899 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET, |
989 element: 'function(o)')), | 900 element: 'function(o)')), |
990 const Test( | 901 const Test( |
991 ''' | 902 ''' |
992 o(a, b) {} | 903 o(a, b) {} |
993 m() => o(null, 42); | 904 m() => o(null, 42); |
994 ''', | 905 ''', |
995 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, | 906 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, |
996 element: 'function(o)', | 907 element: 'function(o)', arguments: '(null,42)')), |
997 arguments: '(null,42)')), | |
998 const Test( | 908 const Test( |
999 ''' | 909 ''' |
1000 o(a, b) {} | 910 o(a, b) {} |
1001 m() => o(null); | 911 m() => o(null); |
1002 ''', | 912 ''', |
1003 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE, | 913 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE, |
1004 element: 'function(o)', | 914 element: 'function(o)', arguments: '(null)')), |
1005 arguments: '(null)')), | |
1006 const Test.prefix( | 915 const Test.prefix( |
1007 ''' | 916 ''' |
1008 o(a, b) {} | 917 o(a, b) {} |
1009 ''', | 918 ''', |
1010 'm() { p.o(null, 42); }', | 919 'm() { p.o(null, 42); }', |
1011 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, | 920 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, |
1012 element: 'function(o)', | 921 element: 'function(o)', arguments: '(null,42)')), |
1013 arguments: '(null,42)')), | |
1014 const Test( | 922 const Test( |
1015 ''' | 923 ''' |
1016 m() => o(null, 42); | 924 m() => o(null, 42); |
1017 ''', | 925 ''', |
1018 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, | 926 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, |
1019 name: 'o', | 927 name: 'o', arguments: '(null,42)')), |
1020 arguments: '(null,42)')), | |
1021 const Test.prefix( | 928 const Test.prefix( |
1022 ''' | 929 ''' |
1023 o(a, b) {} | 930 o(a, b) {} |
1024 ''', | 931 ''', |
1025 'm() => p.o(null, 42);', | 932 'm() => p.o(null, 42);', |
1026 const [ | 933 const [ |
1027 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 934 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
1028 element: 'prefix(p)'), | |
1029 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, | 935 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, |
1030 element: 'function(o)', | 936 element: 'function(o)', arguments: '(null,42)'), |
1031 arguments: '(null,42)'), | |
1032 ], | 937 ], |
1033 isDeferred: true), | 938 isDeferred: true), |
1034 const Test.prefix( | 939 const Test.prefix( |
1035 ''' | 940 ''' |
1036 ''', | 941 ''', |
1037 'm() => p.o(null, 42);', | 942 'm() => p.o(null, 42);', |
1038 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, | 943 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, |
1039 name: 'o', | 944 name: 'o', arguments: '(null,42)')), |
1040 arguments: '(null,42)')), | |
1041 const Test.prefix( | 945 const Test.prefix( |
1042 ''' | 946 ''' |
1043 ''', | 947 ''', |
1044 'm() => p.o(null, 42);', | 948 'm() => p.o(null, 42);', |
1045 const [ | 949 const [ |
1046 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, | 950 const Visit(VisitKind.PREVISIT_DEFERRED_ACCESS, element: 'prefix(p)'), |
1047 element: 'prefix(p)'), | |
1048 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, | 951 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, |
1049 name: 'o', | 952 name: 'o', arguments: '(null,42)'), |
1050 arguments: '(null,42)'), | |
1051 ], | 953 ], |
1052 isDeferred: true), | 954 isDeferred: true), |
1053 const Test.prefix( | 955 const Test.prefix( |
1054 ''' | 956 ''' |
1055 ''', | 957 ''', |
1056 'm() => p(null, 42);', | 958 'm() => p(null, 42);', |
1057 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 959 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
1058 error: MessageKind.PREFIX_AS_EXPRESSION, | 960 error: MessageKind.PREFIX_AS_EXPRESSION, arguments: '(null,42)')), |
1059 arguments: '(null,42)')), | |
1060 const Test( | 961 const Test( |
1061 ''' | 962 ''' |
1062 o(a, b) {} | 963 o(a, b) {} |
1063 m() { o = 42; } | 964 m() { o = 42; } |
1064 ''', | 965 ''', |
1065 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, | 966 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, |
1066 element: 'function(o)', | 967 element: 'function(o)', rhs: '42')), |
1067 rhs: '42')), | |
1068 const Test.prefix( | 968 const Test.prefix( |
1069 ''' | 969 ''' |
1070 o(a, b) {} | 970 o(a, b) {} |
1071 ''', | 971 ''', |
1072 'm() { p.o = 42; }', | 972 'm() { p.o = 42; }', |
1073 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, | 973 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, |
1074 element: 'function(o)', | 974 element: 'function(o)', rhs: '42')), |
1075 rhs: '42')), | |
1076 ], | 975 ], |
1077 'Dynamic properties': const [ | 976 'Dynamic properties': const [ |
1078 // Dynamic properties | 977 // Dynamic properties |
1079 const Test('m(o) => o.foo;', | 978 const Test('m(o) => o.foo;', const [ |
1080 const [ | 979 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, |
1081 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, | 980 receiver: 'o', name: 'foo'), |
1082 receiver: 'o', | 981 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#o)'), |
1083 name: 'foo'), | 982 ]), |
1084 const Visit(VisitKind.VISIT_PARAMETER_GET, | 983 const Test('m(o) { o.foo = 42; }', const [ |
1085 element: 'parameter(m#o)'), | 984 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET, |
1086 ]), | 985 receiver: 'o', name: 'foo', rhs: '42'), |
1087 const Test('m(o) { o.foo = 42; }', | 986 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#o)'), |
1088 const [ | 987 ]), |
1089 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET, | 988 const Test('m(o) { o.foo(null, 42); }', const [ |
1090 receiver: 'o', | 989 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE, |
1091 name: 'foo', | 990 receiver: 'o', name: 'foo', arguments: '(null,42)'), |
1092 rhs: '42'), | 991 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#o)'), |
1093 const Visit(VisitKind.VISIT_PARAMETER_GET, | 992 ]), |
1094 element: 'parameter(m#o)'), | |
1095 ]), | |
1096 const Test('m(o) { o.foo(null, 42); }', | |
1097 const [ | |
1098 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE, | |
1099 receiver: 'o', | |
1100 name: 'foo', | |
1101 arguments: '(null,42)'), | |
1102 const Visit(VisitKind.VISIT_PARAMETER_GET, | |
1103 element: 'parameter(m#o)'), | |
1104 ]), | |
1105 ], | 993 ], |
1106 'This access': const [ | 994 'This access': const [ |
1107 // This access | 995 // This access |
1108 const Test.clazz( | 996 const Test.clazz( |
1109 ''' | 997 ''' |
1110 class C { | 998 class C { |
1111 m() => this; | 999 m() => this; |
1112 } | 1000 } |
1113 ''', | 1001 ''', |
1114 const Visit(VisitKind.VISIT_THIS_GET)), | 1002 const Visit(VisitKind.VISIT_THIS_GET)), |
1115 const Test.clazz( | 1003 const Test.clazz( |
1116 ''' | 1004 ''' |
1117 class C { | 1005 class C { |
1118 call(a, b) {} | 1006 call(a, b) {} |
1119 m() { this(null, 42); } | 1007 m() { this(null, 42); } |
1120 } | 1008 } |
1121 ''', | 1009 ''', |
1122 const Visit(VisitKind.VISIT_THIS_INVOKE, | 1010 const Visit(VisitKind.VISIT_THIS_INVOKE, arguments: '(null,42)')), |
1123 arguments: '(null,42)')), | |
1124 const Test.clazz( | 1011 const Test.clazz( |
1125 ''' | 1012 ''' |
1126 class C { | 1013 class C { |
1127 call(a, b) {} | 1014 call(a, b) {} |
1128 static m() { this(null, 42); } | 1015 static m() { this(null, 42); } |
1129 } | 1016 } |
1130 ''', | 1017 ''', |
1131 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 1018 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
1132 error: MessageKind.NO_THIS_AVAILABLE, | 1019 error: MessageKind.NO_THIS_AVAILABLE, arguments: '(null,42)')), |
1133 arguments: '(null,42)')), | |
1134 ], | 1020 ], |
1135 'This properties': const [ | 1021 'This properties': const [ |
1136 // This properties | 1022 // This properties |
1137 const Test.clazz( | 1023 const Test.clazz( |
1138 ''' | 1024 ''' |
1139 class C { | 1025 class C { |
1140 var foo; | 1026 var foo; |
1141 m() => foo; | 1027 m() => foo; |
1142 } | 1028 } |
1143 ''', | 1029 ''', |
1144 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, | 1030 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, name: 'foo')), |
1145 name: 'foo')), | |
1146 const Test.clazz( | 1031 const Test.clazz( |
1147 ''' | 1032 ''' |
1148 class C { | 1033 class C { |
1149 var foo; | 1034 var foo; |
1150 m() => this.foo; | 1035 m() => this.foo; |
1151 } | 1036 } |
1152 ''', | 1037 ''', |
1153 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, | 1038 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, name: 'foo')), |
1154 name: 'foo')), | |
1155 const Test.clazz( | 1039 const Test.clazz( |
1156 ''' | 1040 ''' |
1157 class C { | 1041 class C { |
1158 get foo => null; | 1042 get foo => null; |
1159 m() => foo; | 1043 m() => foo; |
1160 } | 1044 } |
1161 ''', | 1045 ''', |
1162 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, | 1046 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, name: 'foo')), |
1163 name: 'foo')), | |
1164 const Test.clazz( | 1047 const Test.clazz( |
1165 ''' | 1048 ''' |
1166 class C { | 1049 class C { |
1167 var foo; | 1050 var foo; |
1168 static m() => this.foo; | 1051 static m() => this.foo; |
1169 } | 1052 } |
1170 ''', | 1053 ''', |
1171 const Visit(VisitKind.ERROR_INVALID_GET, | 1054 const Visit(VisitKind.ERROR_INVALID_GET, |
1172 error: MessageKind.NO_THIS_AVAILABLE)), | 1055 error: MessageKind.NO_THIS_AVAILABLE)), |
1173 const Test.clazz( | 1056 const Test.clazz( |
1174 ''' | 1057 ''' |
1175 class C { | 1058 class C { |
1176 get foo => null; | 1059 get foo => null; |
1177 m() => this.foo; | 1060 m() => this.foo; |
1178 } | 1061 } |
1179 ''', | 1062 ''', |
1180 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, | 1063 const Visit(VisitKind.VISIT_THIS_PROPERTY_GET, name: 'foo')), |
1181 name: 'foo')), | |
1182 const Test.clazz( | 1064 const Test.clazz( |
1183 ''' | 1065 ''' |
1184 class C { | 1066 class C { |
1185 var foo; | 1067 var foo; |
1186 m() { foo = 42; } | 1068 m() { foo = 42; } |
1187 } | 1069 } |
1188 ''', | 1070 ''', |
1189 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, | 1071 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, name: 'foo', rhs: '42')), |
1190 name: 'foo', | |
1191 rhs: '42')), | |
1192 const Test.clazz( | 1072 const Test.clazz( |
1193 ''' | 1073 ''' |
1194 class C { | 1074 class C { |
1195 var foo; | 1075 var foo; |
1196 m() { this.foo = 42; } | 1076 m() { this.foo = 42; } |
1197 } | 1077 } |
1198 ''', | 1078 ''', |
1199 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, | 1079 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, name: 'foo', rhs: '42')), |
1200 name: 'foo', | |
1201 rhs: '42')), | |
1202 const Test.clazz( | 1080 const Test.clazz( |
1203 ''' | 1081 ''' |
1204 class C { | 1082 class C { |
1205 set foo(_) {} | 1083 set foo(_) {} |
1206 m() { foo = 42; } | 1084 m() { foo = 42; } |
1207 } | 1085 } |
1208 ''', | 1086 ''', |
1209 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, | 1087 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, name: 'foo', rhs: '42')), |
1210 name: 'foo', | |
1211 rhs: '42')), | |
1212 const Test.clazz( | 1088 const Test.clazz( |
1213 ''' | 1089 ''' |
1214 class C { | 1090 class C { |
1215 set foo(_) {} | 1091 set foo(_) {} |
1216 m() { this.foo = 42; } | 1092 m() { this.foo = 42; } |
1217 } | 1093 } |
1218 ''', | 1094 ''', |
1219 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, | 1095 const Visit(VisitKind.VISIT_THIS_PROPERTY_SET, name: 'foo', rhs: '42')), |
1220 name: 'foo', | |
1221 rhs: '42')), | |
1222 const Test.clazz( | 1096 const Test.clazz( |
1223 ''' | 1097 ''' |
1224 class C { | 1098 class C { |
1225 var foo; | 1099 var foo; |
1226 m() { foo(null, 42); } | 1100 m() { foo(null, 42); } |
1227 } | 1101 } |
1228 ''', | 1102 ''', |
1229 const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE, | 1103 const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE, |
1230 name: 'foo', | 1104 name: 'foo', arguments: '(null,42)')), |
1231 arguments: '(null,42)')), | |
1232 const Test.clazz( | 1105 const Test.clazz( |
1233 ''' | 1106 ''' |
1234 class C { | 1107 class C { |
1235 var foo; | 1108 var foo; |
1236 m() { this.foo(null, 42); } | 1109 m() { this.foo(null, 42); } |
1237 } | 1110 } |
1238 ''', | 1111 ''', |
1239 const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE, | 1112 const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE, |
1240 name: 'foo', | 1113 name: 'foo', arguments: '(null,42)')), |
1241 arguments: '(null,42)')), | |
1242 const Test.clazz( | 1114 const Test.clazz( |
1243 ''' | 1115 ''' |
1244 class C { | 1116 class C { |
1245 var foo; | 1117 var foo; |
1246 static m() { this.foo(null, 42); } | 1118 static m() { this.foo(null, 42); } |
1247 } | 1119 } |
1248 ''', | 1120 ''', |
1249 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 1121 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
1250 error: MessageKind.NO_THIS_AVAILABLE, | 1122 error: MessageKind.NO_THIS_AVAILABLE, arguments: '(null,42)')), |
1251 arguments: '(null,42)')), | |
1252 ], | 1123 ], |
1253 'Super fields': const [ | 1124 'Super fields': const [ |
1254 // Super fields | 1125 // Super fields |
1255 const Test.clazz( | 1126 const Test.clazz( |
1256 ''' | 1127 ''' |
1257 class B { | 1128 class B { |
1258 var o; | 1129 var o; |
1259 } | 1130 } |
1260 class C extends B { | 1131 class C extends B { |
1261 m() => super.o; | 1132 m() => super.o; |
1262 } | 1133 } |
1263 ''', | 1134 ''', |
1264 const Visit(VisitKind.VISIT_SUPER_FIELD_GET, | 1135 const Visit(VisitKind.VISIT_SUPER_FIELD_GET, element: 'field(B#o)')), |
1265 element: 'field(B#o)')), | |
1266 const Test.clazz( | 1136 const Test.clazz( |
1267 ''' | 1137 ''' |
1268 class B { | 1138 class B { |
1269 var o; | 1139 var o; |
1270 } | 1140 } |
1271 class C extends B { | 1141 class C extends B { |
1272 m() { super.o = 42; } | 1142 m() { super.o = 42; } |
1273 } | 1143 } |
1274 ''', | 1144 ''', |
1275 const Visit(VisitKind.VISIT_SUPER_FIELD_SET, | 1145 const Visit(VisitKind.VISIT_SUPER_FIELD_SET, |
1276 element: 'field(B#o)', | 1146 element: 'field(B#o)', rhs: '42')), |
1277 rhs: '42')), | |
1278 const Test.clazz( | 1147 const Test.clazz( |
1279 ''' | 1148 ''' |
1280 class B { | 1149 class B { |
1281 final o = 0; | 1150 final o = 0; |
1282 } | 1151 } |
1283 class C extends B { | 1152 class C extends B { |
1284 m() { super.o = 42; } | 1153 m() { super.o = 42; } |
1285 } | 1154 } |
1286 ''', | 1155 ''', |
1287 const Visit(VisitKind.VISIT_FINAL_SUPER_FIELD_SET, | 1156 const Visit(VisitKind.VISIT_FINAL_SUPER_FIELD_SET, |
1288 element: 'field(B#o)', | 1157 element: 'field(B#o)', rhs: '42')), |
1289 rhs: '42')), | |
1290 const Test.clazz( | 1158 const Test.clazz( |
1291 ''' | 1159 ''' |
1292 class B { | 1160 class B { |
1293 var o; | 1161 var o; |
1294 } | 1162 } |
1295 class C extends B { | 1163 class C extends B { |
1296 m() { super.o(null, 42); } | 1164 m() { super.o(null, 42); } |
1297 } | 1165 } |
1298 ''', | 1166 ''', |
1299 const Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE, | 1167 const Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE, |
1300 element: 'field(B#o)', | 1168 element: 'field(B#o)', arguments: '(null,42)')), |
1301 arguments: '(null,42)')), | |
1302 const Test.clazz( | 1169 const Test.clazz( |
1303 ''' | 1170 ''' |
1304 class B { | 1171 class B { |
1305 } | 1172 } |
1306 class C extends B { | 1173 class C extends B { |
1307 m() => super.o; | 1174 m() => super.o; |
1308 } | 1175 } |
1309 ''', | 1176 ''', |
1310 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)), | 1177 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)), |
1311 const Test.clazz( | 1178 const Test.clazz( |
1312 ''' | 1179 ''' |
1313 class B { | 1180 class B { |
1314 } | 1181 } |
1315 class C extends B { | 1182 class C extends B { |
1316 m() => super.o = 42; | 1183 m() => super.o = 42; |
1317 } | 1184 } |
1318 ''', | 1185 ''', |
1319 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SET, | 1186 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SET, rhs: '42')), |
1320 rhs: '42')), | |
1321 ], | 1187 ], |
1322 'Super properties': const [ | 1188 'Super properties': const [ |
1323 // Super properties | 1189 // Super properties |
1324 const Test.clazz( | 1190 const Test.clazz( |
1325 ''' | 1191 ''' |
1326 class B { | 1192 class B { |
1327 get o => null; | 1193 get o => null; |
1328 } | 1194 } |
1329 class C extends B { | 1195 class C extends B { |
1330 m() => super.o; | 1196 m() => super.o; |
1331 } | 1197 } |
1332 ''', | 1198 ''', |
1333 const Visit(VisitKind.VISIT_SUPER_GETTER_GET, | 1199 const Visit(VisitKind.VISIT_SUPER_GETTER_GET, element: 'getter(B#o)')), |
1334 element: 'getter(B#o)')), | |
1335 const Test.clazz( | 1200 const Test.clazz( |
1336 ''' | 1201 ''' |
1337 class B { | 1202 class B { |
1338 set o(_) {} | 1203 set o(_) {} |
1339 } | 1204 } |
1340 class C extends B { | 1205 class C extends B { |
1341 m() => super.o; | 1206 m() => super.o; |
1342 } | 1207 } |
1343 ''', | 1208 ''', |
1344 const Visit(VisitKind.VISIT_SUPER_SETTER_GET, | 1209 const Visit(VisitKind.VISIT_SUPER_SETTER_GET, element: 'setter(B#o)')), |
1345 element: 'setter(B#o)')), | |
1346 const Test.clazz( | 1210 const Test.clazz( |
1347 ''' | 1211 ''' |
1348 class B { | 1212 class B { |
1349 get o => 0; | 1213 get o => 0; |
1350 } | 1214 } |
1351 class C extends B { | 1215 class C extends B { |
1352 m() { super.o = 42; } | 1216 m() { super.o = 42; } |
1353 } | 1217 } |
1354 ''', | 1218 ''', |
1355 const Visit(VisitKind.VISIT_SUPER_GETTER_SET, | 1219 const Visit(VisitKind.VISIT_SUPER_GETTER_SET, |
1356 element: 'getter(B#o)', | 1220 element: 'getter(B#o)', rhs: '42')), |
1357 rhs: '42')), | |
1358 const Test.clazz( | 1221 const Test.clazz( |
1359 ''' | 1222 ''' |
1360 class B { | 1223 class B { |
1361 set o(_) {} | 1224 set o(_) {} |
1362 } | 1225 } |
1363 class C extends B { | 1226 class C extends B { |
1364 m() { super.o = 42; } | 1227 m() { super.o = 42; } |
1365 } | 1228 } |
1366 ''', | 1229 ''', |
1367 const Visit(VisitKind.VISIT_SUPER_SETTER_SET, | 1230 const Visit(VisitKind.VISIT_SUPER_SETTER_SET, |
1368 element: 'setter(B#o)', | 1231 element: 'setter(B#o)', rhs: '42')), |
1369 rhs: '42')), | |
1370 const Test.clazz( | 1232 const Test.clazz( |
1371 ''' | 1233 ''' |
1372 class B { | 1234 class B { |
1373 get o => null; | 1235 get o => null; |
1374 } | 1236 } |
1375 class C extends B { | 1237 class C extends B { |
1376 m() { super.o(null, 42); } | 1238 m() { super.o(null, 42); } |
1377 } | 1239 } |
1378 ''', | 1240 ''', |
1379 const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE, | 1241 const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE, |
1380 element: 'getter(B#o)', | 1242 element: 'getter(B#o)', arguments: '(null,42)')), |
1381 arguments: '(null,42)')), | |
1382 const Test.clazz( | 1243 const Test.clazz( |
1383 ''' | 1244 ''' |
1384 class B { | 1245 class B { |
1385 set o(_) {} | 1246 set o(_) {} |
1386 } | 1247 } |
1387 class C extends B { | 1248 class C extends B { |
1388 m() { super.o(null, 42); } | 1249 m() { super.o(null, 42); } |
1389 } | 1250 } |
1390 ''', | 1251 ''', |
1391 const Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE, | 1252 const Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE, |
1392 element: 'setter(B#o)', | 1253 element: 'setter(B#o)', arguments: '(null,42)')), |
1393 arguments: '(null,42)')), | |
1394 ], | 1254 ], |
1395 'Super methods': const [ | 1255 'Super methods': const [ |
1396 // Super methods | 1256 // Super methods |
1397 const Test.clazz( | 1257 const Test.clazz( |
1398 ''' | 1258 ''' |
1399 class B { | 1259 class B { |
1400 o(a, b) {} | 1260 o(a, b) {} |
1401 } | 1261 } |
1402 class C extends B { | 1262 class C extends B { |
1403 m() => super.o; | 1263 m() => super.o; |
1404 } | 1264 } |
1405 ''', | 1265 ''', |
1406 const Visit(VisitKind.VISIT_SUPER_METHOD_GET, | 1266 const Visit(VisitKind.VISIT_SUPER_METHOD_GET, |
1407 element: 'function(B#o)')), | 1267 element: 'function(B#o)')), |
1408 const Test.clazz( | 1268 const Test.clazz( |
1409 ''' | 1269 ''' |
1410 class B { | 1270 class B { |
1411 o(a, b) {} | 1271 o(a, b) {} |
1412 } | 1272 } |
1413 class C extends B { | 1273 class C extends B { |
1414 m() { super.o = 42; } | 1274 m() { super.o = 42; } |
1415 } | 1275 } |
1416 ''', | 1276 ''', |
1417 const Visit(VisitKind.VISIT_SUPER_METHOD_SET, | 1277 const Visit(VisitKind.VISIT_SUPER_METHOD_SET, |
1418 element: 'function(B#o)', | 1278 element: 'function(B#o)', rhs: '42')), |
1419 rhs: '42')), | |
1420 const Test.clazz( | 1279 const Test.clazz( |
1421 ''' | 1280 ''' |
1422 class B { | 1281 class B { |
1423 o(a, b) {} | 1282 o(a, b) {} |
1424 } | 1283 } |
1425 class C extends B { | 1284 class C extends B { |
1426 m() { super.o(null, 42); } | 1285 m() { super.o(null, 42); } |
1427 } | 1286 } |
1428 ''', | 1287 ''', |
1429 const Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE, | 1288 const Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE, |
1430 element: 'function(B#o)', | 1289 element: 'function(B#o)', arguments: '(null,42)')), |
1431 arguments: '(null,42)')), | |
1432 const Test.clazz( | 1290 const Test.clazz( |
1433 ''' | 1291 ''' |
1434 class B { | 1292 class B { |
1435 o(a, b) {} | 1293 o(a, b) {} |
1436 } | 1294 } |
1437 class C extends B { | 1295 class C extends B { |
1438 m() { super.o(null); } | 1296 m() { super.o(null); } |
1439 } | 1297 } |
1440 ''', | 1298 ''', |
1441 const Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE, | 1299 const Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE, |
1442 element: 'function(B#o)', | 1300 element: 'function(B#o)', arguments: '(null)')), |
1443 arguments: '(null)')), | |
1444 const Test.clazz( | 1301 const Test.clazz( |
1445 ''' | 1302 ''' |
1446 class B { | 1303 class B { |
1447 } | 1304 } |
1448 class C extends B { | 1305 class C extends B { |
1449 m() => super.o(null, 42); | 1306 m() => super.o(null, 42); |
1450 } | 1307 } |
1451 ''', | 1308 ''', |
1452 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE, | 1309 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE, |
1453 arguments: '(null,42)')), | 1310 arguments: '(null,42)')), |
1454 ], | 1311 ], |
1455 'Expression invoke': const [ | 1312 'Expression invoke': const [ |
1456 // Expression invoke | 1313 // Expression invoke |
1457 const Test('m() => (a, b){}(null, 42);', | 1314 const Test( |
| 1315 'm() => (a, b){}(null, 42);', |
1458 const Visit(VisitKind.VISIT_EXPRESSION_INVOKE, | 1316 const Visit(VisitKind.VISIT_EXPRESSION_INVOKE, |
1459 receiver: '(a,b){}', | 1317 receiver: '(a,b){}', arguments: '(null,42)')), |
1460 arguments: '(null,42)')), | |
1461 ], | 1318 ], |
1462 'Class type literals': const [ | 1319 'Class type literals': const [ |
1463 // Class type literals | 1320 // Class type literals |
1464 const Test( | 1321 const Test( |
1465 ''' | 1322 ''' |
1466 class C {} | 1323 class C {} |
1467 m() => C; | 1324 m() => C; |
1468 ''', | 1325 ''', |
1469 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET, | 1326 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET, constant: 'C')), |
1470 constant: 'C')), | |
1471 const Test( | 1327 const Test( |
1472 ''' | 1328 ''' |
1473 class C {} | 1329 class C {} |
1474 m() => C(null, 42); | 1330 m() => C(null, 42); |
1475 ''', | 1331 ''', |
1476 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE, | 1332 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE, |
1477 constant: 'C', | 1333 constant: 'C', arguments: '(null,42)')), |
1478 arguments: '(null,42)')), | |
1479 const Test( | 1334 const Test( |
1480 ''' | 1335 ''' |
1481 class C {} | 1336 class C {} |
1482 m() => C = 42; | 1337 m() => C = 42; |
1483 ''', | 1338 ''', |
1484 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_SET, | 1339 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_SET, |
1485 constant: 'C', | 1340 constant: 'C', rhs: '42')), |
1486 rhs: '42')), | |
1487 const Test( | 1341 const Test( |
1488 ''' | 1342 ''' |
1489 class C {} | 1343 class C {} |
1490 m() => C += 42; | 1344 m() => C += 42; |
1491 ''', | 1345 ''', |
1492 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND, | 1346 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND, |
1493 constant: 'C', | 1347 constant: 'C', operator: '+=', rhs: '42')), |
1494 operator: '+=', | |
1495 rhs: '42')), | |
1496 const Test( | 1348 const Test( |
1497 ''' | 1349 ''' |
1498 class C {} | 1350 class C {} |
1499 m() => C ??= 42; | 1351 m() => C ??= 42; |
1500 ''', | 1352 ''', |
1501 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_SET_IF_NULL, | 1353 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_SET_IF_NULL, |
1502 constant: 'C', | 1354 constant: 'C', rhs: '42')), |
1503 rhs: '42')), | |
1504 const Test( | 1355 const Test( |
1505 ''' | 1356 ''' |
1506 class C {} | 1357 class C {} |
1507 m() => ++C; | 1358 m() => ++C; |
1508 ''', | 1359 ''', |
1509 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX, | 1360 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX, |
1510 constant: 'C', | 1361 constant: 'C', operator: '++')), |
1511 operator: '++')), | |
1512 const Test( | 1362 const Test( |
1513 ''' | 1363 ''' |
1514 class C {} | 1364 class C {} |
1515 m() => C--; | 1365 m() => C--; |
1516 ''', | 1366 ''', |
1517 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX, | 1367 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX, |
1518 constant: 'C', | 1368 constant: 'C', operator: '--')), |
1519 operator: '--')), | |
1520 const Test( | 1369 const Test( |
1521 ''' | 1370 ''' |
1522 class C {} | 1371 class C {} |
1523 m() => (C).hashCode; | 1372 m() => (C).hashCode; |
1524 ''', | 1373 ''', |
1525 const [ | 1374 const [ |
1526 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, | 1375 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET, |
1527 receiver: '(C)', name: 'hashCode'), | 1376 receiver: '(C)', name: 'hashCode'), |
1528 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET, | 1377 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET, constant: 'C'), |
1529 constant: 'C'), | |
1530 ]), | 1378 ]), |
1531 ], | 1379 ], |
1532 'Typedef type literals': const [ | 1380 'Typedef type literals': const [ |
1533 // Typedef type literals | 1381 // Typedef type literals |
1534 const Test( | 1382 const Test( |
1535 ''' | 1383 ''' |
1536 typedef F(); | 1384 typedef F(); |
1537 m() => F; | 1385 m() => F; |
1538 ''', | 1386 ''', |
1539 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET, | 1387 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET, constant: 'F')), |
1540 constant: 'F')), | |
1541 const Test( | 1388 const Test( |
1542 ''' | 1389 ''' |
1543 typedef F(); | 1390 typedef F(); |
1544 m() => F(null, 42); | 1391 m() => F(null, 42); |
1545 ''', | 1392 ''', |
1546 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE, | 1393 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE, |
1547 constant: 'F', | 1394 constant: 'F', arguments: '(null,42)')), |
1548 arguments: '(null,42)')), | |
1549 const Test( | 1395 const Test( |
1550 ''' | 1396 ''' |
1551 typedef F(); | 1397 typedef F(); |
1552 m() => F = 42; | 1398 m() => F = 42; |
1553 ''', | 1399 ''', |
1554 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET, | 1400 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET, |
1555 constant: 'F', | 1401 constant: 'F', rhs: '42')), |
1556 rhs: '42')), | |
1557 const Test( | 1402 const Test( |
1558 ''' | 1403 ''' |
1559 typedef F(); | 1404 typedef F(); |
1560 m() => F += 42; | 1405 m() => F += 42; |
1561 ''', | 1406 ''', |
1562 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND, | 1407 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND, |
1563 constant: 'F', | 1408 constant: 'F', operator: '+=', rhs: '42')), |
1564 operator: '+=', | |
1565 rhs: '42')), | |
1566 const Test( | 1409 const Test( |
1567 ''' | 1410 ''' |
1568 typedef F(); | 1411 typedef F(); |
1569 m() => F ??= 42; | 1412 m() => F ??= 42; |
1570 ''', | 1413 ''', |
1571 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET_IF_NULL, | 1414 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET_IF_NULL, |
1572 constant: 'F', | 1415 constant: 'F', rhs: '42')), |
1573 rhs: '42')), | |
1574 const Test( | 1416 const Test( |
1575 ''' | 1417 ''' |
1576 typedef F(); | 1418 typedef F(); |
1577 m() => ++F; | 1419 m() => ++F; |
1578 ''', | 1420 ''', |
1579 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX, | 1421 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX, |
1580 constant: 'F', | 1422 constant: 'F', operator: '++')), |
1581 operator: '++')), | |
1582 const Test( | 1423 const Test( |
1583 ''' | 1424 ''' |
1584 typedef F(); | 1425 typedef F(); |
1585 m() => F--; | 1426 m() => F--; |
1586 ''', | 1427 ''', |
1587 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX, | 1428 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX, |
1588 constant: 'F', | 1429 constant: 'F', operator: '--')), |
1589 operator: '--')), | |
1590 ], | 1430 ], |
1591 'Type variable type literals': const [ | 1431 'Type variable type literals': const [ |
1592 // Type variable type literals | 1432 // Type variable type literals |
1593 const Test.clazz( | 1433 const Test.clazz( |
1594 ''' | 1434 ''' |
1595 class C<T> { | 1435 class C<T> { |
1596 m() => T; | 1436 m() => T; |
1597 } | 1437 } |
1598 ''', | 1438 ''', |
1599 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET, | 1439 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET, |
1600 element: 'type_variable(C#T)')), | 1440 element: 'type_variable(C#T)')), |
1601 const Test.clazz( | 1441 const Test.clazz( |
1602 ''' | 1442 ''' |
1603 class C<T> { | 1443 class C<T> { |
1604 m() => T(null, 42); | 1444 m() => T(null, 42); |
1605 } | 1445 } |
1606 ''', | 1446 ''', |
1607 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE, | 1447 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE, |
1608 element: 'type_variable(C#T)', | 1448 element: 'type_variable(C#T)', arguments: '(null,42)')), |
1609 arguments: '(null,42)')), | |
1610 const Test.clazz( | 1449 const Test.clazz( |
1611 ''' | 1450 ''' |
1612 class C<T> { | 1451 class C<T> { |
1613 m() => T = 42; | 1452 m() => T = 42; |
1614 } | 1453 } |
1615 ''', | 1454 ''', |
1616 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET, | 1455 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET, |
1617 element: 'type_variable(C#T)', | 1456 element: 'type_variable(C#T)', rhs: '42')), |
1618 rhs: '42')), | |
1619 const Test.clazz( | 1457 const Test.clazz( |
1620 ''' | 1458 ''' |
1621 class C<T> { | 1459 class C<T> { |
1622 m() => T += 42; | 1460 m() => T += 42; |
1623 } | 1461 } |
1624 ''', | 1462 ''', |
1625 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND, | 1463 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND, |
1626 element: 'type_variable(C#T)', | 1464 element: 'type_variable(C#T)', operator: '+=', rhs: '42')), |
1627 operator: '+=', | |
1628 rhs: '42')), | |
1629 const Test.clazz( | 1465 const Test.clazz( |
1630 ''' | 1466 ''' |
1631 class C<T> { | 1467 class C<T> { |
1632 m() => T ??= 42; | 1468 m() => T ??= 42; |
1633 } | 1469 } |
1634 ''', | 1470 ''', |
1635 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET_IF_NULL, | 1471 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET_IF_NULL, |
1636 element: 'type_variable(C#T)', | 1472 element: 'type_variable(C#T)', rhs: '42')), |
1637 rhs: '42')), | |
1638 const Test.clazz( | 1473 const Test.clazz( |
1639 ''' | 1474 ''' |
1640 class C<T> { | 1475 class C<T> { |
1641 m() => ++T; | 1476 m() => ++T; |
1642 } | 1477 } |
1643 ''', | 1478 ''', |
1644 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX, | 1479 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX, |
1645 element: 'type_variable(C#T)', | 1480 element: 'type_variable(C#T)', operator: '++')), |
1646 operator: '++')), | |
1647 const Test.clazz( | 1481 const Test.clazz( |
1648 ''' | 1482 ''' |
1649 class C<T> { | 1483 class C<T> { |
1650 m() => T--; | 1484 m() => T--; |
1651 } | 1485 } |
1652 ''', | 1486 ''', |
1653 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX, | 1487 const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX, |
1654 element: 'type_variable(C#T)', | 1488 element: 'type_variable(C#T)', operator: '--')), |
1655 operator: '--')), | |
1656 const Test.clazz( | 1489 const Test.clazz( |
1657 ''' | 1490 ''' |
1658 class C<T> { | 1491 class C<T> { |
1659 static m() => T; | 1492 static m() => T; |
1660 } | 1493 } |
1661 ''', | 1494 ''', |
1662 const Visit(VisitKind.ERROR_INVALID_GET, | 1495 const Visit(VisitKind.ERROR_INVALID_GET, |
1663 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER)), | 1496 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER)), |
1664 const Test.clazz( | 1497 const Test.clazz( |
1665 ''' | 1498 ''' |
1666 class C<T> { | 1499 class C<T> { |
1667 static m() => T(null, 42); | 1500 static m() => T(null, 42); |
1668 } | 1501 } |
1669 ''', | 1502 ''', |
1670 const Visit(VisitKind.ERROR_INVALID_INVOKE, | 1503 const Visit(VisitKind.ERROR_INVALID_INVOKE, |
1671 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1504 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
1672 arguments: '(null,42)')), | 1505 arguments: '(null,42)')), |
1673 const Test.clazz( | 1506 const Test.clazz( |
1674 ''' | 1507 ''' |
1675 class C<T> { | 1508 class C<T> { |
1676 static m() => T ??= 42; | 1509 static m() => T ??= 42; |
1677 } | 1510 } |
1678 ''', | 1511 ''', |
1679 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, | 1512 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
1680 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1513 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, rhs: '42')), |
1681 rhs: '42')), | |
1682 const Test.clazz( | 1514 const Test.clazz( |
1683 ''' | 1515 ''' |
1684 class C<T> { | 1516 class C<T> { |
1685 static m() => T ??= 42; | 1517 static m() => T ??= 42; |
1686 } | 1518 } |
1687 ''', | 1519 ''', |
1688 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, | 1520 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
1689 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1521 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, rhs: '42')), |
1690 rhs: '42')), | |
1691 const Test.clazz( | 1522 const Test.clazz( |
1692 ''' | 1523 ''' |
1693 class C<T> { | 1524 class C<T> { |
1694 static m() => ++T; | 1525 static m() => ++T; |
1695 } | 1526 } |
1696 ''', | 1527 ''', |
1697 const Visit(VisitKind.ERROR_INVALID_PREFIX, | 1528 const Visit(VisitKind.ERROR_INVALID_PREFIX, |
1698 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1529 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
1699 operator: '++')), | 1530 operator: '++')), |
1700 const Test.clazz( | 1531 const Test.clazz( |
1701 ''' | 1532 ''' |
1702 class C<T> { | 1533 class C<T> { |
1703 static m() => T--; | 1534 static m() => T--; |
1704 } | 1535 } |
1705 ''', | 1536 ''', |
1706 const Visit(VisitKind.ERROR_INVALID_POSTFIX, | 1537 const Visit(VisitKind.ERROR_INVALID_POSTFIX, |
1707 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, | 1538 error: MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER, |
1708 operator: '--')), | 1539 operator: '--')), |
1709 ], | 1540 ], |
1710 'Dynamic type literals': const [ | 1541 'Dynamic type literals': const [ |
1711 // Dynamic type literals | 1542 // Dynamic type literals |
1712 const Test( | 1543 const Test( |
1713 ''' | 1544 ''' |
1714 m() => dynamic; | 1545 m() => dynamic; |
1715 ''', | 1546 ''', |
1716 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET, | 1547 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET, |
1717 constant: 'dynamic')), | 1548 constant: 'dynamic')), |
1718 // TODO(johnniwinther): Update these to expect the constant to be `dynamic` | 1549 // TODO(johnniwinther): Update these to expect the constant to be `dynamic` |
1719 // instead of `Type`. Currently the compile time constant evaluator cannot | 1550 // instead of `Type`. Currently the compile time constant evaluator cannot |
1720 // detect `dynamic` as a constant subexpression. | 1551 // detect `dynamic` as a constant subexpression. |
1721 const Test( | 1552 const Test( |
1722 ''' | 1553 ''' |
1723 m() { dynamic(null, 42); } | 1554 m() { dynamic(null, 42); } |
1724 ''', | 1555 ''', |
1725 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE, | 1556 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE, |
1726 constant: 'Type', | 1557 constant: 'Type', arguments: '(null,42)')), |
1727 arguments: '(null,42)')), | |
1728 const Test( | 1558 const Test( |
1729 ''' | 1559 ''' |
1730 m() => dynamic = 42; | 1560 m() => dynamic = 42; |
1731 ''', | 1561 ''', |
1732 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET, | 1562 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET, |
1733 constant: 'dynamic', | 1563 constant: 'dynamic', rhs: '42')), |
1734 rhs: '42')), | |
1735 const Test( | 1564 const Test( |
1736 ''' | 1565 ''' |
1737 m() => dynamic += 42; | 1566 m() => dynamic += 42; |
1738 ''', | 1567 ''', |
1739 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND, | 1568 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND, |
1740 constant: 'dynamic', | 1569 constant: 'dynamic', operator: '+=', rhs: '42')), |
1741 operator: '+=', | |
1742 rhs: '42')), | |
1743 const Test( | 1570 const Test( |
1744 ''' | 1571 ''' |
1745 m() => dynamic ??= 42; | 1572 m() => dynamic ??= 42; |
1746 ''', | 1573 ''', |
1747 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET_IF_NULL, | 1574 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET_IF_NULL, |
1748 constant: 'dynamic', | 1575 constant: 'dynamic', rhs: '42')), |
1749 rhs: '42')), | |
1750 const Test( | 1576 const Test( |
1751 ''' | 1577 ''' |
1752 m() => ++dynamic; | 1578 m() => ++dynamic; |
1753 ''', | 1579 ''', |
1754 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX, | 1580 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX, |
1755 constant: 'dynamic', | 1581 constant: 'dynamic', operator: '++')), |
1756 operator: '++')), | |
1757 const Test( | 1582 const Test( |
1758 ''' | 1583 ''' |
1759 m() => dynamic--; | 1584 m() => dynamic--; |
1760 ''', | 1585 ''', |
1761 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX, | 1586 const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX, |
1762 constant: 'dynamic', | 1587 constant: 'dynamic', operator: '--')), |
1763 operator: '--')), | |
1764 ], | 1588 ], |
1765 'Assert': const [ | 1589 'Assert': const [ |
1766 // Assert | 1590 // Assert |
1767 const Test( | 1591 const Test( |
1768 ''' | 1592 ''' |
1769 m() { assert(m()); } | 1593 m() { assert(m()); } |
1770 ''', | 1594 ''', |
1771 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, | 1595 const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE, |
1772 element: 'function(m)', | 1596 element: 'function(m)', arguments: '()')), |
1773 arguments: '()')), | |
1774 ], | 1597 ], |
1775 'Logical and': const [ | 1598 'Logical and': const [ |
1776 // Logical and | 1599 // Logical and |
1777 const Test( | 1600 const Test( |
1778 ''' | 1601 ''' |
1779 m() => true && false; | 1602 m() => true && false; |
1780 ''', | 1603 ''', |
1781 const Visit(VisitKind.VISIT_LOGICAL_AND, left: 'true', right: 'false')), | 1604 const Visit(VisitKind.VISIT_LOGICAL_AND, left: 'true', right: 'false')), |
1782 ], | 1605 ], |
1783 'Logical or': const [ | 1606 'Logical or': const [ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 ''', | 1638 ''', |
1816 const Visit(VisitKind.VISIT_AS, expression: '0', type: 'C')), | 1639 const Visit(VisitKind.VISIT_AS, expression: '0', type: 'C')), |
1817 ], | 1640 ], |
1818 'Binary operators': const [ | 1641 'Binary operators': const [ |
1819 // Binary operators | 1642 // Binary operators |
1820 const Test( | 1643 const Test( |
1821 ''' | 1644 ''' |
1822 m() => 2 + 3; | 1645 m() => 2 + 3; |
1823 ''', | 1646 ''', |
1824 const Visit(VisitKind.VISIT_BINARY, | 1647 const Visit(VisitKind.VISIT_BINARY, |
1825 left: '2', operator: '+', right: '3')), | 1648 left: '2', operator: '+', right: '3')), |
1826 const Test( | 1649 const Test( |
1827 ''' | 1650 ''' |
1828 m() => 2 - 3; | 1651 m() => 2 - 3; |
1829 ''', | 1652 ''', |
1830 const Visit(VisitKind.VISIT_BINARY, | 1653 const Visit(VisitKind.VISIT_BINARY, |
1831 left: '2', operator: '-', right: '3')), | 1654 left: '2', operator: '-', right: '3')), |
1832 const Test( | 1655 const Test( |
1833 ''' | 1656 ''' |
1834 m() => 2 * 3; | 1657 m() => 2 * 3; |
1835 ''', | 1658 ''', |
1836 const Visit(VisitKind.VISIT_BINARY, | 1659 const Visit(VisitKind.VISIT_BINARY, |
1837 left: '2', operator: '*', right: '3')), | 1660 left: '2', operator: '*', right: '3')), |
1838 const Test( | 1661 const Test( |
1839 ''' | 1662 ''' |
1840 m() => 2 / 3; | 1663 m() => 2 / 3; |
1841 ''', | 1664 ''', |
1842 const Visit(VisitKind.VISIT_BINARY, | 1665 const Visit(VisitKind.VISIT_BINARY, |
1843 left: '2', operator: '/', right: '3')), | 1666 left: '2', operator: '/', right: '3')), |
1844 const Test( | 1667 const Test( |
1845 ''' | 1668 ''' |
1846 m() => 2 ~/ 3; | 1669 m() => 2 ~/ 3; |
1847 ''', | 1670 ''', |
1848 const Visit(VisitKind.VISIT_BINARY, | 1671 const Visit(VisitKind.VISIT_BINARY, |
1849 left: '2', operator: '~/', right: '3')), | 1672 left: '2', operator: '~/', right: '3')), |
1850 const Test( | 1673 const Test( |
1851 ''' | 1674 ''' |
1852 m() => 2 % 3; | 1675 m() => 2 % 3; |
1853 ''', | 1676 ''', |
1854 const Visit(VisitKind.VISIT_BINARY, | 1677 const Visit(VisitKind.VISIT_BINARY, |
1855 left: '2', operator: '%', right: '3')), | 1678 left: '2', operator: '%', right: '3')), |
1856 const Test( | 1679 const Test( |
1857 ''' | 1680 ''' |
1858 m() => 2 << 3; | 1681 m() => 2 << 3; |
1859 ''', | 1682 ''', |
1860 const Visit(VisitKind.VISIT_BINARY, | 1683 const Visit(VisitKind.VISIT_BINARY, |
1861 left: '2', operator: '<<', right: '3')), | 1684 left: '2', operator: '<<', right: '3')), |
1862 const Test( | 1685 const Test( |
1863 ''' | 1686 ''' |
1864 m() => 2 >> 3; | 1687 m() => 2 >> 3; |
1865 ''', | 1688 ''', |
1866 const Visit(VisitKind.VISIT_BINARY, | 1689 const Visit(VisitKind.VISIT_BINARY, |
1867 left: '2', operator: '>>', right: '3')), | 1690 left: '2', operator: '>>', right: '3')), |
1868 const Test( | 1691 const Test( |
1869 ''' | 1692 ''' |
1870 m() => 2 <= 3; | 1693 m() => 2 <= 3; |
1871 ''', | 1694 ''', |
1872 const Visit(VisitKind.VISIT_BINARY, | 1695 const Visit(VisitKind.VISIT_BINARY, |
1873 left: '2', operator: '<=', right: '3')), | 1696 left: '2', operator: '<=', right: '3')), |
1874 const Test( | 1697 const Test( |
1875 ''' | 1698 ''' |
1876 m() => 2 < 3; | 1699 m() => 2 < 3; |
1877 ''', | 1700 ''', |
1878 const Visit(VisitKind.VISIT_BINARY, | 1701 const Visit(VisitKind.VISIT_BINARY, |
1879 left: '2', operator: '<', right: '3')), | 1702 left: '2', operator: '<', right: '3')), |
1880 const Test( | 1703 const Test( |
1881 ''' | 1704 ''' |
1882 m() => 2 >= 3; | 1705 m() => 2 >= 3; |
1883 ''', | 1706 ''', |
1884 const Visit(VisitKind.VISIT_BINARY, | 1707 const Visit(VisitKind.VISIT_BINARY, |
1885 left: '2', operator: '>=', right: '3')), | 1708 left: '2', operator: '>=', right: '3')), |
1886 const Test( | 1709 const Test( |
1887 ''' | 1710 ''' |
1888 m() => 2 > 3; | 1711 m() => 2 > 3; |
1889 ''', | 1712 ''', |
1890 const Visit(VisitKind.VISIT_BINARY, | 1713 const Visit(VisitKind.VISIT_BINARY, |
1891 left: '2', operator: '>', right: '3')), | 1714 left: '2', operator: '>', right: '3')), |
1892 const Test( | 1715 const Test( |
1893 ''' | 1716 ''' |
1894 m() => 2 & 3; | 1717 m() => 2 & 3; |
1895 ''', | 1718 ''', |
1896 const Visit(VisitKind.VISIT_BINARY, | 1719 const Visit(VisitKind.VISIT_BINARY, |
1897 left: '2', operator: '&', right: '3')), | 1720 left: '2', operator: '&', right: '3')), |
1898 const Test( | 1721 const Test( |
1899 ''' | 1722 ''' |
1900 m() => 2 | 3; | 1723 m() => 2 | 3; |
1901 ''', | 1724 ''', |
1902 const Visit(VisitKind.VISIT_BINARY, | 1725 const Visit(VisitKind.VISIT_BINARY, |
1903 left: '2', operator: '|', right: '3')), | 1726 left: '2', operator: '|', right: '3')), |
1904 const Test( | 1727 const Test( |
1905 ''' | 1728 ''' |
1906 m() => 2 ^ 3; | 1729 m() => 2 ^ 3; |
1907 ''', | 1730 ''', |
1908 const Visit(VisitKind.VISIT_BINARY, | 1731 const Visit(VisitKind.VISIT_BINARY, |
1909 left: '2', operator: '^', right: '3')), | 1732 left: '2', operator: '^', right: '3')), |
1910 const Test.clazz( | 1733 const Test.clazz( |
1911 ''' | 1734 ''' |
1912 class B { | 1735 class B { |
1913 operator +(_) => null; | 1736 operator +(_) => null; |
1914 } | 1737 } |
1915 class C extends B { | 1738 class C extends B { |
1916 m() => super + 42; | 1739 m() => super + 42; |
1917 } | 1740 } |
1918 ''', | 1741 ''', |
1919 const Visit(VisitKind.VISIT_SUPER_BINARY, | 1742 const Visit(VisitKind.VISIT_SUPER_BINARY, |
1920 element: 'function(B#+)', | 1743 element: 'function(B#+)', operator: '+', right: '42')), |
1921 operator: '+', | |
1922 right: '42')), | |
1923 const Test.clazz( | 1744 const Test.clazz( |
1924 ''' | 1745 ''' |
1925 class B {} | 1746 class B {} |
1926 class C extends B { | 1747 class C extends B { |
1927 m() => super + 42; | 1748 m() => super + 42; |
1928 } | 1749 } |
1929 ''', | 1750 ''', |
1930 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY, | 1751 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY, |
1931 operator: '+', | 1752 operator: '+', right: '42')), |
1932 right: '42')), | |
1933 const Test( | 1753 const Test( |
1934 ''' | 1754 ''' |
1935 m() => 2 === 3; | 1755 m() => 2 === 3; |
1936 ''', | 1756 ''', |
1937 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, | 1757 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, |
1938 left: '2', operator: '===', right: '3')), | 1758 left: '2', operator: '===', right: '3')), |
1939 const Test( | 1759 const Test( |
1940 ''' | 1760 ''' |
1941 m() => 2 !== 3; | 1761 m() => 2 !== 3; |
1942 ''', | 1762 ''', |
1943 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, | 1763 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, |
1944 left: '2', operator: '!==', right: '3')), | 1764 left: '2', operator: '!==', right: '3')), |
1945 const Test.clazz( | 1765 const Test.clazz( |
1946 ''' | 1766 ''' |
1947 class B { | 1767 class B { |
1948 operator +(_) => null; | 1768 operator +(_) => null; |
1949 } | 1769 } |
1950 class C extends B { | 1770 class C extends B { |
1951 static m() => super + 42; | 1771 static m() => super + 42; |
1952 } | 1772 } |
1953 ''', | 1773 ''', |
1954 const Visit(VisitKind.ERROR_INVALID_BINARY, | 1774 const Visit(VisitKind.ERROR_INVALID_BINARY, |
1955 error: MessageKind.NO_SUPER_IN_STATIC, | 1775 error: MessageKind.NO_SUPER_IN_STATIC, operator: '+', right: '42')), |
1956 operator: '+', | |
1957 right: '42')), | |
1958 ], | 1776 ], |
1959 'Index': const [ | 1777 'Index': const [ |
1960 // Index | 1778 // Index |
1961 const Test( | 1779 const Test( |
1962 ''' | 1780 ''' |
1963 m() => 2[3]; | 1781 m() => 2[3]; |
1964 ''', | 1782 ''', |
1965 const Visit(VisitKind.VISIT_INDEX, | 1783 const Visit(VisitKind.VISIT_INDEX, receiver: '2', index: '3')), |
1966 receiver: '2', index: '3')), | |
1967 const Test( | 1784 const Test( |
1968 ''' | 1785 ''' |
1969 m() => --2[3]; | 1786 m() => --2[3]; |
1970 ''', | 1787 ''', |
1971 const Visit(VisitKind.VISIT_INDEX_PREFIX, | 1788 const Visit(VisitKind.VISIT_INDEX_PREFIX, |
1972 receiver: '2', index: '3', operator: '--')), | 1789 receiver: '2', index: '3', operator: '--')), |
1973 const Test( | 1790 const Test( |
1974 ''' | 1791 ''' |
1975 m() => 2[3]++; | 1792 m() => 2[3]++; |
1976 ''', | 1793 ''', |
1977 const Visit(VisitKind.VISIT_INDEX_POSTFIX, | 1794 const Visit(VisitKind.VISIT_INDEX_POSTFIX, |
1978 receiver: '2', index: '3', operator: '++')), | 1795 receiver: '2', index: '3', operator: '++')), |
1979 const Test.clazz( | 1796 const Test.clazz( |
1980 ''' | 1797 ''' |
1981 class B { | 1798 class B { |
1982 operator [](_) => null; | 1799 operator [](_) => null; |
1983 } | 1800 } |
1984 class C extends B { | 1801 class C extends B { |
1985 m() => super[42]; | 1802 m() => super[42]; |
1986 } | 1803 } |
1987 ''', | 1804 ''', |
1988 const Visit(VisitKind.VISIT_SUPER_INDEX, | 1805 const Visit(VisitKind.VISIT_SUPER_INDEX, |
1989 element: 'function(B#[])', | 1806 element: 'function(B#[])', index: '42')), |
1990 index: '42')), | |
1991 const Test.clazz( | 1807 const Test.clazz( |
1992 ''' | 1808 ''' |
1993 class B { | 1809 class B { |
1994 } | 1810 } |
1995 class C extends B { | 1811 class C extends B { |
1996 m() => super[42]; | 1812 m() => super[42]; |
1997 } | 1813 } |
1998 ''', | 1814 ''', |
1999 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX, | 1815 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX, index: '42')), |
2000 index: '42')), | |
2001 const Test.clazz( | 1816 const Test.clazz( |
2002 ''' | 1817 ''' |
2003 class B { | 1818 class B { |
2004 operator [](_) => null; | 1819 operator [](_) => null; |
2005 } | 1820 } |
2006 class C extends B { | 1821 class C extends B { |
2007 static m() => super[42]; | 1822 static m() => super[42]; |
2008 } | 1823 } |
2009 ''', | 1824 ''', |
2010 const Visit(VisitKind.ERROR_INVALID_INDEX, | 1825 const Visit(VisitKind.ERROR_INVALID_INDEX, |
2011 error: MessageKind.NO_SUPER_IN_STATIC, | 1826 error: MessageKind.NO_SUPER_IN_STATIC, index: '42')), |
2012 index: '42')), | |
2013 const Test.clazz( | 1827 const Test.clazz( |
2014 ''' | 1828 ''' |
2015 class B { | 1829 class B { |
2016 operator [](_) => null; | 1830 operator [](_) => null; |
2017 operator []=(a, b) {} | 1831 operator []=(a, b) {} |
2018 } | 1832 } |
2019 class C extends B { | 1833 class C extends B { |
2020 m() => ++super[42]; | 1834 m() => ++super[42]; |
2021 } | 1835 } |
2022 ''', | 1836 ''', |
2023 const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX, | 1837 const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX, |
2024 getter: 'function(B#[])', | 1838 getter: 'function(B#[])', |
2025 setter: 'function(B#[]=)', | 1839 setter: 'function(B#[]=)', |
2026 index: '42', | 1840 index: '42', |
2027 operator: '++')), | 1841 operator: '++')), |
2028 const Test.clazz( | 1842 const Test.clazz( |
2029 ''' | 1843 ''' |
2030 class B { | 1844 class B { |
2031 operator []=(a, b) {} | 1845 operator []=(a, b) {} |
2032 } | 1846 } |
2033 class C extends B { | 1847 class C extends B { |
2034 m() => ++super[42]; | 1848 m() => ++super[42]; |
2035 } | 1849 } |
2036 ''', | 1850 ''', |
2037 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX, | 1851 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX, |
2038 setter: 'function(B#[]=)', | 1852 setter: 'function(B#[]=)', index: '42', operator: '++')), |
2039 index: '42', | |
2040 operator: '++')), | |
2041 const Test.clazz( | 1853 const Test.clazz( |
2042 ''' | 1854 ''' |
2043 class B { | 1855 class B { |
2044 } | 1856 } |
2045 class C extends B { | 1857 class C extends B { |
2046 m() => ++super[42]; | 1858 m() => ++super[42]; |
2047 } | 1859 } |
2048 ''', | 1860 ''', |
2049 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX, | 1861 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX, |
2050 index: '42', | 1862 index: '42', operator: '++')), |
2051 operator: '++')), | |
2052 const Test.clazz( | 1863 const Test.clazz( |
2053 ''' | 1864 ''' |
2054 class B { | 1865 class B { |
2055 operator [](_) => null; | 1866 operator [](_) => null; |
2056 } | 1867 } |
2057 class C extends B { | 1868 class C extends B { |
2058 m() => ++super[42]; | 1869 m() => ++super[42]; |
2059 } | 1870 } |
2060 ''', | 1871 ''', |
2061 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX, | 1872 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX, |
2062 getter: 'function(B#[])', | 1873 getter: 'function(B#[])', index: '42', operator: '++')), |
2063 index: '42', | |
2064 operator: '++')), | |
2065 const Test.clazz( | 1874 const Test.clazz( |
2066 ''' | 1875 ''' |
2067 class B { | 1876 class B { |
2068 operator [](_) => null; | 1877 operator [](_) => null; |
2069 operator []=(a, b) {} | 1878 operator []=(a, b) {} |
2070 } | 1879 } |
2071 class C extends B { | 1880 class C extends B { |
2072 static m() => ++super[42]; | 1881 static m() => ++super[42]; |
2073 } | 1882 } |
2074 ''', | 1883 ''', |
2075 const Visit(VisitKind.ERROR_INVALID_INDEX_PREFIX, | 1884 const Visit(VisitKind.ERROR_INVALID_INDEX_PREFIX, |
2076 error: MessageKind.NO_SUPER_IN_STATIC, | 1885 error: MessageKind.NO_SUPER_IN_STATIC, |
2077 index: '42', | 1886 index: '42', |
2078 operator: '++')), | 1887 operator: '++')), |
2079 const Test.clazz( | 1888 const Test.clazz( |
2080 ''' | 1889 ''' |
2081 class B { | 1890 class B { |
2082 operator [](_) => null; | 1891 operator [](_) => null; |
2083 operator []=(a, b) {} | 1892 operator []=(a, b) {} |
2084 } | 1893 } |
2085 class C extends B { | 1894 class C extends B { |
2086 m() => super[42]--; | 1895 m() => super[42]--; |
2087 } | 1896 } |
2088 ''', | 1897 ''', |
2089 const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX, | 1898 const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX, |
2090 getter: 'function(B#[])', | 1899 getter: 'function(B#[])', |
2091 setter: 'function(B#[]=)', | 1900 setter: 'function(B#[]=)', |
2092 index: '42', | 1901 index: '42', |
2093 operator: '--')), | 1902 operator: '--')), |
2094 const Test.clazz( | 1903 const Test.clazz( |
2095 ''' | 1904 ''' |
2096 class B { | 1905 class B { |
2097 operator []=(a, b) {} | 1906 operator []=(a, b) {} |
2098 } | 1907 } |
2099 class C extends B { | 1908 class C extends B { |
2100 m() => super[42]--; | 1909 m() => super[42]--; |
2101 } | 1910 } |
2102 ''', | 1911 ''', |
2103 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX, | 1912 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX, |
2104 setter: 'function(B#[]=)', | 1913 setter: 'function(B#[]=)', index: '42', operator: '--')), |
2105 index: '42', | |
2106 operator: '--')), | |
2107 const Test.clazz( | 1914 const Test.clazz( |
2108 ''' | 1915 ''' |
2109 class B { | 1916 class B { |
2110 } | 1917 } |
2111 class C extends B { | 1918 class C extends B { |
2112 m() => super[42]--; | 1919 m() => super[42]--; |
2113 } | 1920 } |
2114 ''', | 1921 ''', |
2115 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX, | 1922 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX, |
2116 index: '42', | 1923 index: '42', operator: '--')), |
2117 operator: '--')), | |
2118 const Test.clazz( | 1924 const Test.clazz( |
2119 ''' | 1925 ''' |
2120 class B { | 1926 class B { |
2121 operator [](_) => null; | 1927 operator [](_) => null; |
2122 } | 1928 } |
2123 class C extends B { | 1929 class C extends B { |
2124 m() => super[42]--; | 1930 m() => super[42]--; |
2125 } | 1931 } |
2126 ''', | 1932 ''', |
2127 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX, | 1933 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX, |
2128 getter: 'function(B#[])', | 1934 getter: 'function(B#[])', index: '42', operator: '--')), |
2129 index: '42', | |
2130 operator: '--')), | |
2131 const Test.clazz( | 1935 const Test.clazz( |
2132 ''' | 1936 ''' |
2133 class B { | 1937 class B { |
2134 operator [](_) => null; | 1938 operator [](_) => null; |
2135 operator []=(a, b) {} | 1939 operator []=(a, b) {} |
2136 } | 1940 } |
2137 class C extends B { | 1941 class C extends B { |
2138 static m() => super[42]--; | 1942 static m() => super[42]--; |
2139 } | 1943 } |
2140 ''', | 1944 ''', |
2141 const Visit(VisitKind.ERROR_INVALID_INDEX_POSTFIX, | 1945 const Visit(VisitKind.ERROR_INVALID_INDEX_POSTFIX, |
2142 error: MessageKind.NO_SUPER_IN_STATIC, | 1946 error: MessageKind.NO_SUPER_IN_STATIC, |
2143 index: '42', | 1947 index: '42', |
2144 operator: '--')), | 1948 operator: '--')), |
2145 const Test( | 1949 const Test( |
2146 ''' | 1950 ''' |
2147 m() => [][42] ??= 0; | 1951 m() => [][42] ??= 0; |
2148 ''', | 1952 ''', |
2149 const Visit(VisitKind.VISIT_INDEX_SET_IF_NULL, | 1953 const Visit(VisitKind.VISIT_INDEX_SET_IF_NULL, |
2150 receiver: '[] ', | 1954 receiver: '[] ', index: '42', rhs: '0')), |
2151 index: '42', | |
2152 rhs: '0')), | |
2153 const Test.clazz( | 1955 const Test.clazz( |
2154 ''' | 1956 ''' |
2155 class B { | 1957 class B { |
2156 operator [](_) => null; | 1958 operator [](_) => null; |
2157 operator []=(a, b) {} | 1959 operator []=(a, b) {} |
2158 } | 1960 } |
2159 class C extends B { | 1961 class C extends B { |
2160 m() => super[42] ??= 0; | 1962 m() => super[42] ??= 0; |
2161 } | 1963 } |
2162 ''', | 1964 ''', |
2163 const Visit(VisitKind.VISIT_SUPER_INDEX_SET_IF_NULL, | 1965 const Visit(VisitKind.VISIT_SUPER_INDEX_SET_IF_NULL, |
2164 getter: 'function(B#[])', | 1966 getter: 'function(B#[])', |
2165 setter: 'function(B#[]=)', | 1967 setter: 'function(B#[]=)', |
2166 index: '42', | 1968 index: '42', |
2167 rhs: '0')), | 1969 rhs: '0')), |
2168 const Test.clazz( | 1970 const Test.clazz( |
2169 ''' | 1971 ''' |
2170 class B { | 1972 class B { |
2171 operator []=(a, b) {} | 1973 operator []=(a, b) {} |
2172 } | 1974 } |
2173 class C extends B { | 1975 class C extends B { |
2174 m() => super[42] ??= 0; | 1976 m() => super[42] ??= 0; |
2175 } | 1977 } |
2176 ''', | 1978 ''', |
2177 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_SET_IF_NULL, | 1979 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_SET_IF_NULL, |
2178 setter: 'function(B#[]=)', | 1980 setter: 'function(B#[]=)', index: '42', rhs: '0')), |
2179 index: '42', | |
2180 rhs: '0')), | |
2181 const Test.clazz( | 1981 const Test.clazz( |
2182 ''' | 1982 ''' |
2183 class B { | 1983 class B { |
2184 operator [](_) => null; | 1984 operator [](_) => null; |
2185 } | 1985 } |
2186 class C extends B { | 1986 class C extends B { |
2187 m() => super[42] ??= 0; | 1987 m() => super[42] ??= 0; |
2188 } | 1988 } |
2189 ''', | 1989 ''', |
2190 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_SET_IF_NULL, | 1990 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_SET_IF_NULL, |
2191 getter: 'function(B#[])', | 1991 getter: 'function(B#[])', index: '42', rhs: '0')), |
2192 index: '42', | |
2193 rhs: '0')), | |
2194 const Test.clazz( | 1992 const Test.clazz( |
2195 ''' | 1993 ''' |
2196 class B { | 1994 class B { |
2197 } | 1995 } |
2198 class C extends B { | 1996 class C extends B { |
2199 m() => super[42] ??= 0; | 1997 m() => super[42] ??= 0; |
2200 } | 1998 } |
2201 ''', | 1999 ''', |
2202 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET_IF_NULL, | 2000 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET_IF_NULL, |
2203 index: '42', | 2001 index: '42', rhs: '0')), |
2204 rhs: '0')), | |
2205 ], | 2002 ], |
2206 'Equals': const [ | 2003 'Equals': const [ |
2207 // Equals | 2004 // Equals |
2208 const Test( | 2005 const Test( |
2209 ''' | 2006 ''' |
2210 m() => 2 == 3; | 2007 m() => 2 == 3; |
2211 ''', | 2008 ''', |
2212 const Visit(VisitKind.VISIT_EQUALS, | 2009 const Visit(VisitKind.VISIT_EQUALS, left: '2', right: '3')), |
2213 left: '2', right: '3')), | |
2214 const Test.clazz( | 2010 const Test.clazz( |
2215 ''' | 2011 ''' |
2216 class B { | 2012 class B { |
2217 operator ==(_) => null; | 2013 operator ==(_) => null; |
2218 } | 2014 } |
2219 class C extends B { | 2015 class C extends B { |
2220 m() => super == 42; | 2016 m() => super == 42; |
2221 } | 2017 } |
2222 ''', | 2018 ''', |
2223 const Visit(VisitKind.VISIT_SUPER_EQUALS, | 2019 const Visit(VisitKind.VISIT_SUPER_EQUALS, |
2224 element: 'function(B#==)', | 2020 element: 'function(B#==)', right: '42')), |
2225 right: '42')), | |
2226 const Test.clazz( | 2021 const Test.clazz( |
2227 ''' | 2022 ''' |
2228 class B { | 2023 class B { |
2229 operator ==(_) => null; | 2024 operator ==(_) => null; |
2230 } | 2025 } |
2231 class C extends B { | 2026 class C extends B { |
2232 static m() => super == 42; | 2027 static m() => super == 42; |
2233 } | 2028 } |
2234 ''', | 2029 ''', |
2235 const Visit(VisitKind.ERROR_INVALID_EQUALS, | 2030 const Visit(VisitKind.ERROR_INVALID_EQUALS, |
2236 error: MessageKind.NO_SUPER_IN_STATIC, | 2031 error: MessageKind.NO_SUPER_IN_STATIC, right: '42')), |
2237 right: '42')), | |
2238 ], | 2032 ], |
2239 'Not equals': const [ | 2033 'Not equals': const [ |
2240 // Not equals | 2034 // Not equals |
2241 const Test( | 2035 const Test( |
2242 ''' | 2036 ''' |
2243 m() => 2 != 3; | 2037 m() => 2 != 3; |
2244 ''', | 2038 ''', |
2245 const Visit(VisitKind.VISIT_NOT_EQUALS, | 2039 const Visit(VisitKind.VISIT_NOT_EQUALS, left: '2', right: '3')), |
2246 left: '2', right: '3')), | |
2247 const Test.clazz( | 2040 const Test.clazz( |
2248 ''' | 2041 ''' |
2249 class B { | 2042 class B { |
2250 operator ==(_) => null; | 2043 operator ==(_) => null; |
2251 } | 2044 } |
2252 class C extends B { | 2045 class C extends B { |
2253 m() => super != 42; | 2046 m() => super != 42; |
2254 } | 2047 } |
2255 ''', | 2048 ''', |
2256 const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS, | 2049 const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS, |
2257 element: 'function(B#==)', | 2050 element: 'function(B#==)', right: '42')), |
2258 right: '42')), | |
2259 const Test.clazz( | 2051 const Test.clazz( |
2260 ''' | 2052 ''' |
2261 class B { | 2053 class B { |
2262 operator ==(_) => null; | 2054 operator ==(_) => null; |
2263 } | 2055 } |
2264 class C extends B { | 2056 class C extends B { |
2265 static m() => super != 42; | 2057 static m() => super != 42; |
2266 } | 2058 } |
2267 ''', | 2059 ''', |
2268 const Visit(VisitKind.ERROR_INVALID_NOT_EQUALS, | 2060 const Visit(VisitKind.ERROR_INVALID_NOT_EQUALS, |
2269 error: MessageKind.NO_SUPER_IN_STATIC, | 2061 error: MessageKind.NO_SUPER_IN_STATIC, right: '42')), |
2270 right: '42')), | |
2271 ], | 2062 ], |
2272 'Unary expression': const [ | 2063 'Unary expression': const [ |
2273 // Unary expression | 2064 // Unary expression |
2274 const Test( | 2065 const Test( |
2275 ''' | 2066 ''' |
2276 m() => -false; | 2067 m() => -false; |
2277 ''', | 2068 ''', |
2278 const Visit(VisitKind.VISIT_UNARY, | 2069 const Visit(VisitKind.VISIT_UNARY, expression: 'false', operator: '-')), |
2279 expression: 'false', operator: '-')), | |
2280 const Test( | 2070 const Test( |
2281 ''' | 2071 ''' |
2282 m() => ~false; | 2072 m() => ~false; |
2283 ''', | 2073 ''', |
2284 const Visit(VisitKind.VISIT_UNARY, | 2074 const Visit(VisitKind.VISIT_UNARY, expression: 'false', operator: '~')), |
2285 expression: 'false', operator: '~')), | |
2286 const Test.clazz( | 2075 const Test.clazz( |
2287 ''' | 2076 ''' |
2288 class B { | 2077 class B { |
2289 operator -() => null; | 2078 operator -() => null; |
2290 } | 2079 } |
2291 class C extends B { | 2080 class C extends B { |
2292 m() => -super; | 2081 m() => -super; |
2293 } | 2082 } |
2294 ''', | 2083 ''', |
2295 const Visit(VisitKind.VISIT_SUPER_UNARY, | 2084 const Visit(VisitKind.VISIT_SUPER_UNARY, |
2296 element: 'function(B#unary-)', operator: '-')), | 2085 element: 'function(B#unary-)', operator: '-')), |
2297 const Test.clazz( | 2086 const Test.clazz( |
2298 ''' | 2087 ''' |
2299 class B { | 2088 class B { |
2300 } | 2089 } |
2301 class C extends B { | 2090 class C extends B { |
2302 m() => -super; | 2091 m() => -super; |
2303 } | 2092 } |
2304 ''', | 2093 ''', |
2305 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY, | 2094 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY, operator: '-')), |
2306 operator: '-')), | |
2307 const Test.clazz( | 2095 const Test.clazz( |
2308 ''' | 2096 ''' |
2309 class B { | 2097 class B { |
2310 operator ~() => null; | 2098 operator ~() => null; |
2311 } | 2099 } |
2312 class C extends B { | 2100 class C extends B { |
2313 m() => ~super; | 2101 m() => ~super; |
2314 } | 2102 } |
2315 ''', | 2103 ''', |
2316 const Visit(VisitKind.VISIT_SUPER_UNARY, | 2104 const Visit(VisitKind.VISIT_SUPER_UNARY, |
2317 element: 'function(B#~)', operator: '~')), | 2105 element: 'function(B#~)', operator: '~')), |
2318 const Test.clazz( | 2106 const Test.clazz( |
2319 ''' | 2107 ''' |
2320 class B { | 2108 class B { |
2321 operator -() => null; | 2109 operator -() => null; |
2322 } | 2110 } |
2323 class C extends B { | 2111 class C extends B { |
2324 static m() => -super; | 2112 static m() => -super; |
2325 } | 2113 } |
2326 ''', | 2114 ''', |
2327 const Visit(VisitKind.ERROR_INVALID_UNARY, | 2115 const Visit(VisitKind.ERROR_INVALID_UNARY, |
2328 error: MessageKind.NO_SUPER_IN_STATIC, | 2116 error: MessageKind.NO_SUPER_IN_STATIC, operator: '-')), |
2329 operator: '-')), | |
2330 const Test( | 2117 const Test( |
2331 ''' | 2118 ''' |
2332 m() => !0; | 2119 m() => !0; |
2333 ''', | 2120 ''', |
2334 const Visit(VisitKind.VISIT_NOT, expression: '0')), | 2121 const Visit(VisitKind.VISIT_NOT, expression: '0')), |
2335 const Test( | 2122 const Test( |
2336 ''' | 2123 ''' |
2337 m() => +false; | 2124 m() => +false; |
2338 ''', | 2125 ''', |
2339 // TODO(johnniwinther): Should this be an | 2126 // TODO(johnniwinther): Should this be an |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 ], | 2171 ], |
2385 'Compound assignment': const [ | 2172 'Compound assignment': const [ |
2386 // Compound assignment | 2173 // Compound assignment |
2387 const Test( | 2174 const Test( |
2388 ''' | 2175 ''' |
2389 m(a) => a.b += 42; | 2176 m(a) => a.b += 42; |
2390 ''', | 2177 ''', |
2391 const [ | 2178 const [ |
2392 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND, | 2179 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND, |
2393 receiver: 'a', name: 'b', operator: '+=', rhs: '42'), | 2180 receiver: 'a', name: 'b', operator: '+=', rhs: '42'), |
2394 const Visit(VisitKind.VISIT_PARAMETER_GET, | 2181 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)') |
2395 element: 'parameter(m#a)') | |
2396 ]), | 2182 ]), |
2397 const Test( | 2183 const Test( |
2398 ''' | 2184 ''' |
2399 m(a) => a += 42; | 2185 m(a) => a += 42; |
2400 ''', | 2186 ''', |
2401 const Visit(VisitKind.VISIT_PARAMETER_COMPOUND, | 2187 const Visit(VisitKind.VISIT_PARAMETER_COMPOUND, |
2402 element: 'parameter(m#a)', operator: '+=', rhs: '42')), | 2188 element: 'parameter(m#a)', operator: '+=', rhs: '42')), |
2403 const Test( | 2189 const Test( |
2404 ''' | 2190 ''' |
2405 m(final a) => a += 42; | 2191 m(final a) => a += 42; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 ''', | 2226 ''', |
2441 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND, | 2227 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND, |
2442 element: 'field(a)', operator: '+=', rhs: '42')), | 2228 element: 'field(a)', operator: '+=', rhs: '42')), |
2443 const Test( | 2229 const Test( |
2444 ''' | 2230 ''' |
2445 get a => 0; | 2231 get a => 0; |
2446 set a(_) {} | 2232 set a(_) {} |
2447 m() => a += 42; | 2233 m() => a += 42; |
2448 ''', | 2234 ''', |
2449 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND, | 2235 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND, |
2450 getter: 'getter(a)', setter: 'setter(a)', | 2236 getter: 'getter(a)', |
2451 operator: '+=', rhs: '42')), | 2237 setter: 'setter(a)', |
| 2238 operator: '+=', |
| 2239 rhs: '42')), |
2452 const Test( | 2240 const Test( |
2453 ''' | 2241 ''' |
2454 class C { | 2242 class C { |
2455 static var a; | 2243 static var a; |
2456 } | 2244 } |
2457 m() => C.a += 42; | 2245 m() => C.a += 42; |
2458 ''', | 2246 ''', |
2459 const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND, | 2247 const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND, |
2460 element: 'field(C#a)', operator: '+=', rhs: '42')), | 2248 element: 'field(C#a)', operator: '+=', rhs: '42')), |
2461 const Test.clazz( | 2249 const Test.clazz( |
(...skipping 26 matching lines...) Expand all Loading... |
2488 const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND, | 2276 const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND, |
2489 element: 'field(C#a)', operator: '+=', rhs: '42')), | 2277 element: 'field(C#a)', operator: '+=', rhs: '42')), |
2490 const Test.clazz( | 2278 const Test.clazz( |
2491 ''' | 2279 ''' |
2492 class C { | 2280 class C { |
2493 var o; | 2281 var o; |
2494 static m() { o += 42; } | 2282 static m() { o += 42; } |
2495 } | 2283 } |
2496 ''', | 2284 ''', |
2497 const Visit(VisitKind.ERROR_INVALID_COMPOUND, | 2285 const Visit(VisitKind.ERROR_INVALID_COMPOUND, |
2498 error: MessageKind.NO_INSTANCE_AVAILABLE, | 2286 error: MessageKind.NO_INSTANCE_AVAILABLE, |
2499 operator: '+=', | 2287 operator: '+=', |
2500 rhs: '42')), | 2288 rhs: '42')), |
2501 const Test.prefix( | 2289 const Test.prefix( |
2502 ''' | 2290 ''' |
2503 ''', | 2291 ''', |
2504 ''' | 2292 ''' |
2505 m() { p += 42; } | 2293 m() { p += 42; } |
2506 ''', | 2294 ''', |
2507 const Visit(VisitKind.ERROR_INVALID_COMPOUND, | 2295 const Visit(VisitKind.ERROR_INVALID_COMPOUND, |
2508 error: MessageKind.PREFIX_AS_EXPRESSION, | 2296 error: MessageKind.PREFIX_AS_EXPRESSION, |
2509 operator: '+=', | 2297 operator: '+=', |
2510 rhs: '42')), | 2298 rhs: '42')), |
2511 const Test( | 2299 const Test( |
2512 ''' | 2300 ''' |
2513 class C { | 2301 class C { |
2514 static get a => 0; | 2302 static get a => 0; |
2515 static set a(_) {} | 2303 static set a(_) {} |
2516 } | 2304 } |
2517 m() => C.a += 42; | 2305 m() => C.a += 42; |
2518 ''', | 2306 ''', |
2519 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, | 2307 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, |
2520 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2308 getter: 'getter(C#a)', |
2521 operator: '+=', rhs: '42')), | 2309 setter: 'setter(C#a)', |
| 2310 operator: '+=', |
| 2311 rhs: '42')), |
2522 const Test.clazz( | 2312 const Test.clazz( |
2523 ''' | 2313 ''' |
2524 class C { | 2314 class C { |
2525 static get a => 0; | 2315 static get a => 0; |
2526 static set a(_) {} | 2316 static set a(_) {} |
2527 m() => C.a += 42; | 2317 m() => C.a += 42; |
2528 } | 2318 } |
2529 ''', | 2319 ''', |
2530 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, | 2320 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, |
2531 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2321 getter: 'getter(C#a)', |
2532 operator: '+=', rhs: '42')), | 2322 setter: 'setter(C#a)', |
| 2323 operator: '+=', |
| 2324 rhs: '42')), |
2533 const Test.clazz( | 2325 const Test.clazz( |
2534 ''' | 2326 ''' |
2535 class C { | 2327 class C { |
2536 static get a => 0; | 2328 static get a => 0; |
2537 static set a(_) {} | 2329 static set a(_) {} |
2538 m() => a += 42; | 2330 m() => a += 42; |
2539 } | 2331 } |
2540 ''', | 2332 ''', |
2541 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, | 2333 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, |
2542 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2334 getter: 'getter(C#a)', |
2543 operator: '+=', rhs: '42')), | 2335 setter: 'setter(C#a)', |
| 2336 operator: '+=', |
| 2337 rhs: '42')), |
2544 const Test.prefix( | 2338 const Test.prefix( |
2545 ''' | 2339 ''' |
2546 class C { | 2340 class C { |
2547 static get a => 0; | 2341 static get a => 0; |
2548 static set a(_) {} | 2342 static set a(_) {} |
2549 } | 2343 } |
2550 ''', | 2344 ''', |
2551 ''' | 2345 ''' |
2552 m() => p.C.a += 42; | 2346 m() => p.C.a += 42; |
2553 ''', | 2347 ''', |
2554 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, | 2348 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND, |
2555 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2349 getter: 'getter(C#a)', |
2556 operator: '+=', rhs: '42')), | 2350 setter: 'setter(C#a)', |
| 2351 operator: '+=', |
| 2352 rhs: '42')), |
2557 // TODO(johnniwinther): Enable these when dart2js supports method and setter | 2353 // TODO(johnniwinther): Enable these when dart2js supports method and setter |
2558 // with the same name. | 2354 // with the same name. |
2559 /*const Test( | 2355 /*const Test( |
2560 ''' | 2356 ''' |
2561 class C { | 2357 class C { |
2562 static a() {} | 2358 static a() {} |
2563 static set a(_) {} | 2359 static set a(_) {} |
2564 } | 2360 } |
2565 m() => C.a += 42; | 2361 m() => C.a += 42; |
2566 ''', | 2362 ''', |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2646 ''' | 2442 ''' |
2647 class B { | 2443 class B { |
2648 get a => 0; | 2444 get a => 0; |
2649 set a (_) {} | 2445 set a (_) {} |
2650 } | 2446 } |
2651 class C extends B { | 2447 class C extends B { |
2652 m() => super.a += 42; | 2448 m() => super.a += 42; |
2653 } | 2449 } |
2654 ''', | 2450 ''', |
2655 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND, | 2451 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND, |
2656 getter: 'getter(B#a)', setter: 'setter(B#a)', | 2452 getter: 'getter(B#a)', |
2657 operator: '+=', rhs: '42')), | 2453 setter: 'setter(B#a)', |
| 2454 operator: '+=', |
| 2455 rhs: '42')), |
2658 const Test.clazz( | 2456 const Test.clazz( |
2659 ''' | 2457 ''' |
2660 class A { | 2458 class A { |
2661 get a => 0; | 2459 get a => 0; |
2662 } | 2460 } |
2663 class B extends A { | 2461 class B extends A { |
2664 set a (_) {} | 2462 set a (_) {} |
2665 } | 2463 } |
2666 class C extends B { | 2464 class C extends B { |
2667 m() => super.a += 42; | 2465 m() => super.a += 42; |
2668 } | 2466 } |
2669 ''', | 2467 ''', |
2670 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND, | 2468 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND, |
2671 getter: 'getter(A#a)', setter: 'setter(B#a)', | 2469 getter: 'getter(A#a)', |
2672 operator: '+=', rhs: '42')), | 2470 setter: 'setter(B#a)', |
| 2471 operator: '+=', |
| 2472 rhs: '42')), |
2673 const Test.clazz( | 2473 const Test.clazz( |
2674 ''' | 2474 ''' |
2675 class A { | 2475 class A { |
2676 var a; | 2476 var a; |
2677 } | 2477 } |
2678 class B extends A { | 2478 class B extends A { |
2679 get a => 0; | 2479 get a => 0; |
2680 } | 2480 } |
2681 | 2481 |
2682 class C extends B { | 2482 class C extends B { |
2683 m() => super.a += 42; | 2483 m() => super.a += 42; |
2684 } | 2484 } |
2685 ''', | 2485 ''', |
2686 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND, | 2486 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND, |
2687 getter: 'getter(B#a)', setter: 'field(A#a)', | 2487 getter: 'getter(B#a)', |
2688 operator: '+=', rhs: '42')), | 2488 setter: 'field(A#a)', |
| 2489 operator: '+=', |
| 2490 rhs: '42')), |
2689 const Test.clazz( | 2491 const Test.clazz( |
2690 ''' | 2492 ''' |
2691 class A { | 2493 class A { |
2692 var a; | 2494 var a; |
2693 } | 2495 } |
2694 class B extends A { | 2496 class B extends A { |
2695 set a(_) {} | 2497 set a(_) {} |
2696 } | 2498 } |
2697 | 2499 |
2698 class C extends B { | 2500 class C extends B { |
2699 m() => super.a += 42; | 2501 m() => super.a += 42; |
2700 } | 2502 } |
2701 ''', | 2503 ''', |
2702 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND, | 2504 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND, |
2703 getter: 'field(A#a)', setter: 'setter(B#a)', | 2505 getter: 'field(A#a)', |
2704 operator: '+=', rhs: '42')), | 2506 setter: 'setter(B#a)', |
| 2507 operator: '+=', |
| 2508 rhs: '42')), |
2705 const Test.clazz( | 2509 const Test.clazz( |
2706 ''' | 2510 ''' |
2707 class A { | 2511 class A { |
2708 var a; | 2512 var a; |
2709 } | 2513 } |
2710 class B extends A { | 2514 class B extends A { |
2711 final a = 0; | 2515 final a = 0; |
2712 } | 2516 } |
2713 | 2517 |
2714 class C extends B { | 2518 class C extends B { |
2715 m() => super.a += 42; | 2519 m() => super.a += 42; |
2716 } | 2520 } |
2717 ''', | 2521 ''', |
2718 // TODO(johnniwinther): Change this to | 2522 // TODO(johnniwinther): Change this to |
2719 // [VISIT_SUPER_FIELD_FIELD_COMPOUND] when dart2js supports shadow | 2523 // [VISIT_SUPER_FIELD_FIELD_COMPOUND] when dart2js supports shadow |
2720 // setters. | 2524 // setters. |
2721 const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND, | 2525 const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND, |
2722 element: 'field(B#a)', | 2526 element: 'field(B#a)', operator: '+=', rhs: '42')), |
2723 operator: '+=', rhs: '42')), | |
2724 const Test.clazz( | 2527 const Test.clazz( |
2725 ''' | 2528 ''' |
2726 class B { | 2529 class B { |
2727 a() {} | 2530 a() {} |
2728 } | 2531 } |
2729 class C extends B { | 2532 class C extends B { |
2730 m() => super.a += 42; | 2533 m() => super.a += 42; |
2731 } | 2534 } |
2732 ''', | 2535 ''', |
2733 const Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND, | 2536 const Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND, |
2734 element: 'function(B#a)', | 2537 element: 'function(B#a)', operator: '+=', rhs: '42')), |
2735 operator: '+=', rhs: '42')), | |
2736 const Test.clazz( | 2538 const Test.clazz( |
2737 ''' | 2539 ''' |
2738 class B { | 2540 class B { |
2739 } | 2541 } |
2740 class C extends B { | 2542 class C extends B { |
2741 m() => super.a += 42; | 2543 m() => super.a += 42; |
2742 } | 2544 } |
2743 ''', | 2545 ''', |
2744 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND, | 2546 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND, |
2745 operator: '+=', rhs: '42')), | 2547 operator: '+=', rhs: '42')), |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 ''' | 2659 ''' |
2858 class B { | 2660 class B { |
2859 operator [](_) {} | 2661 operator [](_) {} |
2860 operator []=(a, b) {} | 2662 operator []=(a, b) {} |
2861 } | 2663 } |
2862 class C extends B { | 2664 class C extends B { |
2863 m() => super[1] += 42; | 2665 m() => super[1] += 42; |
2864 } | 2666 } |
2865 ''', | 2667 ''', |
2866 const Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET, | 2668 const Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET, |
2867 getter: 'function(B#[])', setter: 'function(B#[]=)', | 2669 getter: 'function(B#[])', |
2868 index: '1', operator: '+=', rhs: '42')), | 2670 setter: 'function(B#[]=)', |
| 2671 index: '1', |
| 2672 operator: '+=', |
| 2673 rhs: '42')), |
2869 const Test.clazz( | 2674 const Test.clazz( |
2870 ''' | 2675 ''' |
2871 class B { | 2676 class B { |
2872 operator []=(a, b) {} | 2677 operator []=(a, b) {} |
2873 } | 2678 } |
2874 class C extends B { | 2679 class C extends B { |
2875 m() => super[1] += 42; | 2680 m() => super[1] += 42; |
2876 } | 2681 } |
2877 ''', | 2682 ''', |
2878 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET, | 2683 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET, |
2879 setter: 'function(B#[]=)', | 2684 setter: 'function(B#[]=)', index: '1', operator: '+=', rhs: '42')), |
2880 index: '1', operator: '+=', rhs: '42')), | |
2881 const Test.clazz( | 2685 const Test.clazz( |
2882 ''' | 2686 ''' |
2883 class B { | 2687 class B { |
2884 } | 2688 } |
2885 class C extends B { | 2689 class C extends B { |
2886 m() => super[1] += 42; | 2690 m() => super[1] += 42; |
2887 } | 2691 } |
2888 ''', | 2692 ''', |
2889 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET, | 2693 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET, |
2890 index: '1', operator: '+=', rhs: '42')), | 2694 index: '1', operator: '+=', rhs: '42')), |
2891 const Test.clazz( | 2695 const Test.clazz( |
2892 ''' | 2696 ''' |
2893 class B { | 2697 class B { |
2894 operator [](_) {} | 2698 operator [](_) {} |
2895 } | 2699 } |
2896 class C extends B { | 2700 class C extends B { |
2897 m() => super[1] += 42; | 2701 m() => super[1] += 42; |
2898 } | 2702 } |
2899 ''', | 2703 ''', |
2900 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET, | 2704 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET, |
2901 getter: 'function(B#[])', | 2705 getter: 'function(B#[])', index: '1', operator: '+=', rhs: '42')), |
2902 index: '1', operator: '+=', rhs: '42')), | |
2903 const Test.clazz( | 2706 const Test.clazz( |
2904 ''' | 2707 ''' |
2905 class B { | 2708 class B { |
2906 operator [](_) {} | 2709 operator [](_) {} |
2907 operator []=(a, b) {} | 2710 operator []=(a, b) {} |
2908 } | 2711 } |
2909 class C extends B { | 2712 class C extends B { |
2910 static m() => super[1] += 42; | 2713 static m() => super[1] += 42; |
2911 } | 2714 } |
2912 ''', | 2715 ''', |
2913 const Visit(VisitKind.ERROR_INVALID_COMPOUND_INDEX_SET, | 2716 const Visit(VisitKind.ERROR_INVALID_COMPOUND_INDEX_SET, |
2914 error: MessageKind.NO_SUPER_IN_STATIC, | 2717 error: MessageKind.NO_SUPER_IN_STATIC, |
2915 index: '1', operator: '+=', rhs: '42')), | 2718 index: '1', |
| 2719 operator: '+=', |
| 2720 rhs: '42')), |
2916 ], | 2721 ], |
2917 'Prefix expression': const [ | 2722 'Prefix expression': const [ |
2918 // Prefix expression | 2723 // Prefix expression |
2919 const Test( | 2724 const Test( |
2920 ''' | 2725 ''' |
2921 m(a) => --a.b; | 2726 m(a) => --a.b; |
2922 ''', | 2727 ''', |
2923 const [ | 2728 const [ |
2924 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX, | 2729 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX, |
2925 receiver: 'a', name: 'b', operator: '--'), | 2730 receiver: 'a', name: 'b', operator: '--'), |
2926 const Visit(VisitKind.VISIT_PARAMETER_GET, | 2731 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)') |
2927 element: 'parameter(m#a)') | |
2928 ]), | 2732 ]), |
2929 const Test( | 2733 const Test( |
2930 ''' | 2734 ''' |
2931 m(a) => ++a; | 2735 m(a) => ++a; |
2932 ''', | 2736 ''', |
2933 const Visit(VisitKind.VISIT_PARAMETER_PREFIX, | 2737 const Visit(VisitKind.VISIT_PARAMETER_PREFIX, |
2934 element: 'parameter(m#a)', operator: '++')), | 2738 element: 'parameter(m#a)', operator: '++')), |
2935 const Test( | 2739 const Test( |
2936 ''' | 2740 ''' |
2937 m(final a) => ++a; | 2741 m(final a) => ++a; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2972 ''', | 2776 ''', |
2973 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX, | 2777 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX, |
2974 element: 'field(a)', operator: '++')), | 2778 element: 'field(a)', operator: '++')), |
2975 const Test( | 2779 const Test( |
2976 ''' | 2780 ''' |
2977 get a => 0; | 2781 get a => 0; |
2978 set a(_) {} | 2782 set a(_) {} |
2979 m() => --a; | 2783 m() => --a; |
2980 ''', | 2784 ''', |
2981 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX, | 2785 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX, |
2982 getter: 'getter(a)', setter: 'setter(a)', | 2786 getter: 'getter(a)', setter: 'setter(a)', operator: '--')), |
2983 operator: '--')), | |
2984 const Test( | 2787 const Test( |
2985 ''' | 2788 ''' |
2986 class C { | 2789 class C { |
2987 static var a; | 2790 static var a; |
2988 } | 2791 } |
2989 m() => ++C.a; | 2792 m() => ++C.a; |
2990 ''', | 2793 ''', |
2991 const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX, | 2794 const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX, |
2992 element: 'field(C#a)', operator: '++')), | 2795 element: 'field(C#a)', operator: '++')), |
2993 const Test.clazz( | 2796 const Test.clazz( |
(...skipping 26 matching lines...) Expand all Loading... |
3020 const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX, | 2823 const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX, |
3021 element: 'field(C#a)', operator: '--')), | 2824 element: 'field(C#a)', operator: '--')), |
3022 const Test.clazz( | 2825 const Test.clazz( |
3023 ''' | 2826 ''' |
3024 class C { | 2827 class C { |
3025 var o; | 2828 var o; |
3026 static m() { ++o; } | 2829 static m() { ++o; } |
3027 } | 2830 } |
3028 ''', | 2831 ''', |
3029 const Visit(VisitKind.ERROR_INVALID_PREFIX, | 2832 const Visit(VisitKind.ERROR_INVALID_PREFIX, |
3030 error: MessageKind.NO_INSTANCE_AVAILABLE, | 2833 error: MessageKind.NO_INSTANCE_AVAILABLE, operator: '++')), |
3031 operator: '++')), | |
3032 const Test.prefix( | 2834 const Test.prefix( |
3033 ''' | 2835 ''' |
3034 ''', | 2836 ''', |
3035 ''' | 2837 ''' |
3036 m() { ++p; } | 2838 m() { ++p; } |
3037 ''', | 2839 ''', |
3038 const Visit(VisitKind.ERROR_INVALID_PREFIX, | 2840 const Visit(VisitKind.ERROR_INVALID_PREFIX, |
3039 error: MessageKind.PREFIX_AS_EXPRESSION, | 2841 error: MessageKind.PREFIX_AS_EXPRESSION, operator: '++')), |
3040 operator: '++')), | |
3041 const Test( | 2842 const Test( |
3042 ''' | 2843 ''' |
3043 class C { | 2844 class C { |
3044 static get a => 0; | 2845 static get a => 0; |
3045 static set a(_) {} | 2846 static set a(_) {} |
3046 } | 2847 } |
3047 m() => ++C.a; | 2848 m() => ++C.a; |
3048 ''', | 2849 ''', |
3049 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, | 2850 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, |
3050 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2851 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '++')), |
3051 operator: '++')), | |
3052 const Test.clazz( | 2852 const Test.clazz( |
3053 ''' | 2853 ''' |
3054 class C { | 2854 class C { |
3055 static get a => 0; | 2855 static get a => 0; |
3056 static set a(_) {} | 2856 static set a(_) {} |
3057 m() => --C.a; | 2857 m() => --C.a; |
3058 } | 2858 } |
3059 ''', | 2859 ''', |
3060 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, | 2860 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, |
3061 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2861 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '--')), |
3062 operator: '--')), | |
3063 const Test.clazz( | 2862 const Test.clazz( |
3064 ''' | 2863 ''' |
3065 class C { | 2864 class C { |
3066 static get a => 0; | 2865 static get a => 0; |
3067 static set a(_) {} | 2866 static set a(_) {} |
3068 m() => --a; | 2867 m() => --a; |
3069 } | 2868 } |
3070 ''', | 2869 ''', |
3071 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, | 2870 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, |
3072 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2871 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '--')), |
3073 operator: '--')), | |
3074 const Test.prefix( | 2872 const Test.prefix( |
3075 ''' | 2873 ''' |
3076 class C { | 2874 class C { |
3077 static get a => 0; | 2875 static get a => 0; |
3078 static set a(_) {} | 2876 static set a(_) {} |
3079 } | 2877 } |
3080 ''', | 2878 ''', |
3081 ''' | 2879 ''' |
3082 m() => ++p.C.a; | 2880 m() => ++p.C.a; |
3083 ''', | 2881 ''', |
3084 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, | 2882 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX, |
3085 getter: 'getter(C#a)', setter: 'setter(C#a)', | 2883 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '++')), |
3086 operator: '++')), | |
3087 const Test.clazz( | 2884 const Test.clazz( |
3088 ''' | 2885 ''' |
3089 class C { | 2886 class C { |
3090 var a; | 2887 var a; |
3091 m() => --a; | 2888 m() => --a; |
3092 } | 2889 } |
3093 ''', | 2890 ''', |
3094 const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX, | 2891 const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX, |
3095 name: 'a', operator: '--')), | 2892 name: 'a', operator: '--')), |
3096 const Test.clazz( | 2893 const Test.clazz( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 ''' | 2925 ''' |
3129 class B { | 2926 class B { |
3130 get a => 0; | 2927 get a => 0; |
3131 set a (_) {} | 2928 set a (_) {} |
3132 } | 2929 } |
3133 class C extends B { | 2930 class C extends B { |
3134 m() => --super.a; | 2931 m() => --super.a; |
3135 } | 2932 } |
3136 ''', | 2933 ''', |
3137 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX, | 2934 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX, |
3138 getter: 'getter(B#a)', setter: 'setter(B#a)', | 2935 getter: 'getter(B#a)', setter: 'setter(B#a)', operator: '--')), |
3139 operator: '--')), | |
3140 const Test.clazz( | 2936 const Test.clazz( |
3141 ''' | 2937 ''' |
3142 class A { | 2938 class A { |
3143 get a => 0; | 2939 get a => 0; |
3144 } | 2940 } |
3145 class B extends A { | 2941 class B extends A { |
3146 set a (_) {} | 2942 set a (_) {} |
3147 } | 2943 } |
3148 class C extends B { | 2944 class C extends B { |
3149 m() => ++super.a; | 2945 m() => ++super.a; |
3150 } | 2946 } |
3151 ''', | 2947 ''', |
3152 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX, | 2948 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX, |
3153 getter: 'getter(A#a)', setter: 'setter(B#a)', | 2949 getter: 'getter(A#a)', setter: 'setter(B#a)', operator: '++')), |
3154 operator: '++')), | |
3155 const Test.clazz( | 2950 const Test.clazz( |
3156 ''' | 2951 ''' |
3157 class A { | 2952 class A { |
3158 var a; | 2953 var a; |
3159 } | 2954 } |
3160 class B extends A { | 2955 class B extends A { |
3161 get a => 0; | 2956 get a => 0; |
3162 } | 2957 } |
3163 | 2958 |
3164 class C extends B { | 2959 class C extends B { |
3165 m() => --super.a; | 2960 m() => --super.a; |
3166 } | 2961 } |
3167 ''', | 2962 ''', |
3168 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX, | 2963 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX, |
3169 getter: 'getter(B#a)', setter: 'field(A#a)', | 2964 getter: 'getter(B#a)', setter: 'field(A#a)', operator: '--')), |
3170 operator: '--')), | |
3171 const Test.clazz( | 2965 const Test.clazz( |
3172 ''' | 2966 ''' |
3173 class A { | 2967 class A { |
3174 var a; | 2968 var a; |
3175 } | 2969 } |
3176 class B extends A { | 2970 class B extends A { |
3177 set a(_) {} | 2971 set a(_) {} |
3178 } | 2972 } |
3179 | 2973 |
3180 class C extends B { | 2974 class C extends B { |
3181 m() => ++super.a; | 2975 m() => ++super.a; |
3182 } | 2976 } |
3183 ''', | 2977 ''', |
3184 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX, | 2978 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX, |
3185 getter: 'field(A#a)', setter: 'setter(B#a)', | 2979 getter: 'field(A#a)', setter: 'setter(B#a)', operator: '++')), |
3186 operator: '++')), | |
3187 const Test.clazz( | 2980 const Test.clazz( |
3188 ''' | 2981 ''' |
3189 class B { | 2982 class B { |
3190 a() {} | 2983 a() {} |
3191 } | 2984 } |
3192 class C extends B { | 2985 class C extends B { |
3193 m() => ++super.a; | 2986 m() => ++super.a; |
3194 } | 2987 } |
3195 ''', | 2988 ''', |
3196 const Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX, | 2989 const Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX, |
3197 element: 'function(B#a)', | 2990 element: 'function(B#a)', operator: '++')), |
3198 operator: '++')), | |
3199 const Test.clazz( | 2991 const Test.clazz( |
3200 ''' | 2992 ''' |
3201 class B { | 2993 class B { |
3202 } | 2994 } |
3203 class C extends B { | 2995 class C extends B { |
3204 m() => ++super.a; | 2996 m() => ++super.a; |
3205 } | 2997 } |
3206 ''', | 2998 ''', |
3207 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX, | 2999 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX, operator: '++')), |
3208 operator: '++')), | |
3209 const Test.clazz( | 3000 const Test.clazz( |
3210 ''' | 3001 ''' |
3211 class B { | 3002 class B { |
3212 set a(_) {} | 3003 set a(_) {} |
3213 } | 3004 } |
3214 class C extends B { | 3005 class C extends B { |
3215 m() => ++super.a; | 3006 m() => ++super.a; |
3216 } | 3007 } |
3217 ''', | 3008 ''', |
3218 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX, | 3009 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3298 final a = 42; | 3089 final a = 42; |
3299 m() => ++a; | 3090 m() => ++a; |
3300 ''', | 3091 ''', |
3301 const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX, | 3092 const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX, |
3302 element: 'field(a)', operator: '++')), | 3093 element: 'field(a)', operator: '++')), |
3303 | 3094 |
3304 const Test( | 3095 const Test( |
3305 ''' | 3096 ''' |
3306 m() => ++unresolved; | 3097 m() => ++unresolved; |
3307 ''', | 3098 ''', |
3308 const Visit(VisitKind.VISIT_UNRESOLVED_PREFIX, | 3099 const Visit(VisitKind.VISIT_UNRESOLVED_PREFIX, operator: '++')), |
3309 operator: '++')), | |
3310 ], | 3100 ], |
3311 'Postfix expression': const [ | 3101 'Postfix expression': const [ |
3312 // Postfix expression | 3102 // Postfix expression |
3313 const Test( | 3103 const Test( |
3314 ''' | 3104 ''' |
3315 m(a) => a.b--; | 3105 m(a) => a.b--; |
3316 ''', | 3106 ''', |
3317 const [ | 3107 const [ |
3318 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX, | 3108 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX, |
3319 receiver: 'a', name: 'b', operator: '--'), | 3109 receiver: 'a', name: 'b', operator: '--'), |
3320 const Visit(VisitKind.VISIT_PARAMETER_GET, | 3110 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)') |
3321 element: 'parameter(m#a)') | |
3322 ]), | 3111 ]), |
3323 const Test( | 3112 const Test( |
3324 ''' | 3113 ''' |
3325 m(a) => a++; | 3114 m(a) => a++; |
3326 ''', | 3115 ''', |
3327 const Visit(VisitKind.VISIT_PARAMETER_POSTFIX, | 3116 const Visit(VisitKind.VISIT_PARAMETER_POSTFIX, |
3328 element: 'parameter(m#a)', operator: '++')), | 3117 element: 'parameter(m#a)', operator: '++')), |
3329 const Test( | 3118 const Test( |
3330 ''' | 3119 ''' |
3331 m(final a) => a++; | 3120 m(final a) => a++; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3366 ''', | 3155 ''', |
3367 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX, | 3156 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX, |
3368 element: 'field(a)', operator: '++')), | 3157 element: 'field(a)', operator: '++')), |
3369 const Test( | 3158 const Test( |
3370 ''' | 3159 ''' |
3371 get a => 0; | 3160 get a => 0; |
3372 set a(_) {} | 3161 set a(_) {} |
3373 m() => a--; | 3162 m() => a--; |
3374 ''', | 3163 ''', |
3375 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX, | 3164 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX, |
3376 getter: 'getter(a)', setter: 'setter(a)', | 3165 getter: 'getter(a)', setter: 'setter(a)', operator: '--')), |
3377 operator: '--')), | |
3378 const Test( | 3166 const Test( |
3379 ''' | 3167 ''' |
3380 class C { | 3168 class C { |
3381 static var a; | 3169 static var a; |
3382 } | 3170 } |
3383 m() => C.a++; | 3171 m() => C.a++; |
3384 ''', | 3172 ''', |
3385 const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX, | 3173 const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX, |
3386 element: 'field(C#a)', operator: '++')), | 3174 element: 'field(C#a)', operator: '++')), |
3387 const Test.clazz( | 3175 const Test.clazz( |
(...skipping 26 matching lines...) Expand all Loading... |
3414 const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX, | 3202 const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX, |
3415 element: 'field(C#a)', operator: '--')), | 3203 element: 'field(C#a)', operator: '--')), |
3416 const Test.clazz( | 3204 const Test.clazz( |
3417 ''' | 3205 ''' |
3418 class C { | 3206 class C { |
3419 var o; | 3207 var o; |
3420 static m() { o--; } | 3208 static m() { o--; } |
3421 } | 3209 } |
3422 ''', | 3210 ''', |
3423 const Visit(VisitKind.ERROR_INVALID_POSTFIX, | 3211 const Visit(VisitKind.ERROR_INVALID_POSTFIX, |
3424 error: MessageKind.NO_INSTANCE_AVAILABLE, | 3212 error: MessageKind.NO_INSTANCE_AVAILABLE, operator: '--')), |
3425 operator: '--')), | |
3426 const Test.prefix( | 3213 const Test.prefix( |
3427 ''' | 3214 ''' |
3428 ''', | 3215 ''', |
3429 ''' | 3216 ''' |
3430 m() { p--; } | 3217 m() { p--; } |
3431 ''', | 3218 ''', |
3432 const Visit(VisitKind.ERROR_INVALID_POSTFIX, | 3219 const Visit(VisitKind.ERROR_INVALID_POSTFIX, |
3433 error: MessageKind.PREFIX_AS_EXPRESSION, | 3220 error: MessageKind.PREFIX_AS_EXPRESSION, operator: '--')), |
3434 operator: '--')), | |
3435 const Test( | 3221 const Test( |
3436 ''' | 3222 ''' |
3437 class C { | 3223 class C { |
3438 static get a => 0; | 3224 static get a => 0; |
3439 static set a(_) {} | 3225 static set a(_) {} |
3440 } | 3226 } |
3441 m() => C.a++; | 3227 m() => C.a++; |
3442 ''', | 3228 ''', |
3443 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, | 3229 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, |
3444 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3230 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '++')), |
3445 operator: '++')), | |
3446 const Test.clazz( | 3231 const Test.clazz( |
3447 ''' | 3232 ''' |
3448 class C { | 3233 class C { |
3449 static get a => 0; | 3234 static get a => 0; |
3450 static set a(_) {} | 3235 static set a(_) {} |
3451 m() => C.a--; | 3236 m() => C.a--; |
3452 } | 3237 } |
3453 ''', | 3238 ''', |
3454 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, | 3239 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, |
3455 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3240 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '--')), |
3456 operator: '--')), | |
3457 const Test.clazz( | 3241 const Test.clazz( |
3458 ''' | 3242 ''' |
3459 class C { | 3243 class C { |
3460 static get a => 0; | 3244 static get a => 0; |
3461 static set a(_) {} | 3245 static set a(_) {} |
3462 m() => a--; | 3246 m() => a--; |
3463 } | 3247 } |
3464 ''', | 3248 ''', |
3465 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, | 3249 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, |
3466 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3250 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '--')), |
3467 operator: '--')), | |
3468 const Test.prefix( | 3251 const Test.prefix( |
3469 ''' | 3252 ''' |
3470 class C { | 3253 class C { |
3471 static get a => 0; | 3254 static get a => 0; |
3472 static set a(_) {} | 3255 static set a(_) {} |
3473 } | 3256 } |
3474 ''', | 3257 ''', |
3475 ''' | 3258 ''' |
3476 m() => p.C.a++; | 3259 m() => p.C.a++; |
3477 ''', | 3260 ''', |
3478 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, | 3261 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX, |
3479 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3262 getter: 'getter(C#a)', setter: 'setter(C#a)', operator: '++')), |
3480 operator: '++')), | |
3481 const Test.clazz( | 3263 const Test.clazz( |
3482 ''' | 3264 ''' |
3483 class C { | 3265 class C { |
3484 var a; | 3266 var a; |
3485 m() => a--; | 3267 m() => a--; |
3486 } | 3268 } |
3487 ''', | 3269 ''', |
3488 const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX, | 3270 const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX, |
3489 name: 'a', operator: '--')), | 3271 name: 'a', operator: '--')), |
3490 const Test.clazz( | 3272 const Test.clazz( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3522 ''' | 3304 ''' |
3523 class B { | 3305 class B { |
3524 get a => 0; | 3306 get a => 0; |
3525 set a (_) {} | 3307 set a (_) {} |
3526 } | 3308 } |
3527 class C extends B { | 3309 class C extends B { |
3528 m() => super.a--; | 3310 m() => super.a--; |
3529 } | 3311 } |
3530 ''', | 3312 ''', |
3531 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX, | 3313 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX, |
3532 getter: 'getter(B#a)', setter: 'setter(B#a)', | 3314 getter: 'getter(B#a)', setter: 'setter(B#a)', operator: '--')), |
3533 operator: '--')), | |
3534 const Test.clazz( | 3315 const Test.clazz( |
3535 ''' | 3316 ''' |
3536 class A { | 3317 class A { |
3537 get a => 0; | 3318 get a => 0; |
3538 } | 3319 } |
3539 class B extends A { | 3320 class B extends A { |
3540 set a (_) {} | 3321 set a (_) {} |
3541 } | 3322 } |
3542 class C extends B { | 3323 class C extends B { |
3543 m() => super.a++; | 3324 m() => super.a++; |
3544 } | 3325 } |
3545 ''', | 3326 ''', |
3546 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX, | 3327 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX, |
3547 getter: 'getter(A#a)', setter: 'setter(B#a)', | 3328 getter: 'getter(A#a)', setter: 'setter(B#a)', operator: '++')), |
3548 operator: '++')), | |
3549 const Test.clazz( | 3329 const Test.clazz( |
3550 ''' | 3330 ''' |
3551 class A { | 3331 class A { |
3552 var a; | 3332 var a; |
3553 } | 3333 } |
3554 class B extends A { | 3334 class B extends A { |
3555 get a => 0; | 3335 get a => 0; |
3556 } | 3336 } |
3557 | 3337 |
3558 class C extends B { | 3338 class C extends B { |
3559 m() => super.a--; | 3339 m() => super.a--; |
3560 } | 3340 } |
3561 ''', | 3341 ''', |
3562 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX, | 3342 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX, |
3563 getter: 'getter(B#a)', setter: 'field(A#a)', | 3343 getter: 'getter(B#a)', setter: 'field(A#a)', operator: '--')), |
3564 operator: '--')), | |
3565 const Test.clazz( | 3344 const Test.clazz( |
3566 ''' | 3345 ''' |
3567 class A { | 3346 class A { |
3568 var a; | 3347 var a; |
3569 } | 3348 } |
3570 class B extends A { | 3349 class B extends A { |
3571 set a(_) {} | 3350 set a(_) {} |
3572 } | 3351 } |
3573 | 3352 |
3574 class C extends B { | 3353 class C extends B { |
3575 m() => super.a++; | 3354 m() => super.a++; |
3576 } | 3355 } |
3577 ''', | 3356 ''', |
3578 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX, | 3357 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX, |
3579 getter: 'field(A#a)', setter: 'setter(B#a)', | 3358 getter: 'field(A#a)', setter: 'setter(B#a)', operator: '++')), |
3580 operator: '++')), | |
3581 const Test.clazz( | 3359 const Test.clazz( |
3582 ''' | 3360 ''' |
3583 class B { | 3361 class B { |
3584 a() {} | 3362 a() {} |
3585 } | 3363 } |
3586 class C extends B { | 3364 class C extends B { |
3587 m() => super.a++; | 3365 m() => super.a++; |
3588 } | 3366 } |
3589 ''', | 3367 ''', |
3590 const Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX, | 3368 const Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX, |
3591 element: 'function(B#a)', | 3369 element: 'function(B#a)', operator: '++')), |
3592 operator: '++')), | |
3593 const Test.clazz( | 3370 const Test.clazz( |
3594 ''' | 3371 ''' |
3595 class B { | 3372 class B { |
3596 } | 3373 } |
3597 class C extends B { | 3374 class C extends B { |
3598 m() => super.a++; | 3375 m() => super.a++; |
3599 } | 3376 } |
3600 ''', | 3377 ''', |
3601 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX, | 3378 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX, operator: '++')), |
3602 operator: '++')), | |
3603 const Test.clazz( | 3379 const Test.clazz( |
3604 ''' | 3380 ''' |
3605 class B { | 3381 class B { |
3606 set a(_) {} | 3382 set a(_) {} |
3607 } | 3383 } |
3608 class C extends B { | 3384 class C extends B { |
3609 m() => super.a++; | 3385 m() => super.a++; |
3610 } | 3386 } |
3611 ''', | 3387 ''', |
3612 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX, | 3388 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 final a = 42; | 3468 final a = 42; |
3693 m() => a++; | 3469 m() => a++; |
3694 ''', | 3470 ''', |
3695 const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX, | 3471 const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX, |
3696 element: 'field(a)', operator: '++')), | 3472 element: 'field(a)', operator: '++')), |
3697 | 3473 |
3698 const Test( | 3474 const Test( |
3699 ''' | 3475 ''' |
3700 m() => unresolved++; | 3476 m() => unresolved++; |
3701 ''', | 3477 ''', |
3702 const Visit(VisitKind.VISIT_UNRESOLVED_POSTFIX, | 3478 const Visit(VisitKind.VISIT_UNRESOLVED_POSTFIX, operator: '++')), |
3703 operator: '++')), | |
3704 ], | 3479 ], |
3705 'Constructor invocations': const [ | 3480 'Constructor invocations': const [ |
3706 const Test( | 3481 const Test( |
3707 ''' | 3482 ''' |
3708 class Class { | 3483 class Class { |
3709 const Class(a, b); | 3484 const Class(a, b); |
3710 } | 3485 } |
3711 m() => const Class(true, 42); | 3486 m() => const Class(true, 42); |
3712 ''', | 3487 ''', |
3713 const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE, | 3488 const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE, |
3714 constant: 'const Class(true, 42)')), | 3489 constant: 'const Class(true, 42)')), |
3715 const Test( | 3490 const Test( |
3716 ''' | 3491 ''' |
3717 m() => const bool.fromEnvironment('foo'); | 3492 m() => const bool.fromEnvironment('foo'); |
3718 ''', | 3493 ''', |
3719 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, | 3494 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, |
3720 constant: | 3495 constant: 'const bool.fromEnvironment("foo")')), |
3721 'const bool.fromEnvironment("foo")')), | |
3722 const Test( | 3496 const Test( |
3723 ''' | 3497 ''' |
3724 m() => const bool.fromEnvironment('foo', defaultValue: true); | 3498 m() => const bool.fromEnvironment('foo', defaultValue: true); |
3725 ''', | 3499 ''', |
3726 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, | 3500 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, |
3727 constant: 'const bool.fromEnvironment("foo", defaultValue: true)')), | 3501 constant: 'const bool.fromEnvironment("foo", defaultValue: true)')), |
3728 const Test( | 3502 const Test( |
3729 ''' | 3503 ''' |
3730 m() => const int.fromEnvironment('foo'); | 3504 m() => const int.fromEnvironment('foo'); |
3731 ''', | 3505 ''', |
3732 const Visit(VisitKind.VISIT_INT_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, | 3506 const Visit(VisitKind.VISIT_INT_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, |
3733 constant: 'const int.fromEnvironment("foo")')), | 3507 constant: 'const int.fromEnvironment("foo")')), |
3734 const Test( | 3508 const Test( |
3735 ''' | 3509 ''' |
3736 m() => const String.fromEnvironment('foo'); | 3510 m() => const String.fromEnvironment('foo'); |
3737 ''', | 3511 ''', |
3738 const Visit(VisitKind.VISIT_STRING_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, | 3512 const Visit(VisitKind.VISIT_STRING_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, |
3739 constant: | 3513 constant: 'const String.fromEnvironment("foo")')), |
3740 'const String.fromEnvironment("foo")')), | |
3741 const Test( | 3514 const Test( |
3742 ''' | 3515 ''' |
3743 class Class { | 3516 class Class { |
3744 Class(a, b); | 3517 Class(a, b); |
3745 } | 3518 } |
3746 m() => const Class(true, 42); | 3519 m() => const Class(true, 42); |
3747 ''', | 3520 ''', |
3748 const Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE, | 3521 const Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE, |
3749 element: 'generative_constructor(Class#)', | 3522 element: 'generative_constructor(Class#)', |
3750 arguments: '(true,42)', | 3523 arguments: '(true,42)', |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3907 arguments: '(true,42)', | 3680 arguments: '(true,42)', |
3908 type: 'Class<double>', | 3681 type: 'Class<double>', |
3909 selector: 'CallStructure(arity=2)')), | 3682 selector: 'CallStructure(arity=2)')), |
3910 const Test( | 3683 const Test( |
3911 ''' | 3684 ''' |
3912 class Class { | 3685 class Class { |
3913 Class(a, b); | 3686 Class(a, b); |
3914 } | 3687 } |
3915 m() => new Class.unresolved(true, 42); | 3688 m() => new Class.unresolved(true, 42); |
3916 ''', | 3689 ''', |
3917 const Visit( | 3690 const Visit(VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE, |
3918 VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE, | |
3919 arguments: '(true,42)')), | 3691 arguments: '(true,42)')), |
3920 const Test( | 3692 const Test( |
3921 ''' | 3693 ''' |
3922 m() => new Unresolved(true, 42); | 3694 m() => new Unresolved(true, 42); |
3923 ''', | 3695 ''', |
3924 const Visit( | 3696 const Visit(VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE, |
3925 VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE, | |
3926 arguments: '(true,42)')), | 3697 arguments: '(true,42)')), |
3927 const Test( | 3698 const Test( |
3928 ''' | 3699 ''' |
3929 abstract class AbstractClass {} | 3700 abstract class AbstractClass {} |
3930 m() => new AbstractClass(); | 3701 m() => new AbstractClass(); |
3931 ''', | 3702 ''', |
3932 const Visit( | 3703 const Visit(VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE, |
3933 VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE, | |
3934 element: 'generative_constructor(AbstractClass#)', | 3704 element: 'generative_constructor(AbstractClass#)', |
3935 type: 'AbstractClass', | 3705 type: 'AbstractClass', |
3936 arguments: '()', | 3706 arguments: '()', |
3937 selector: 'CallStructure(arity=0)')), | 3707 selector: 'CallStructure(arity=0)')), |
3938 const Test( | 3708 const Test( |
3939 ''' | 3709 ''' |
3940 class Class { | 3710 class Class { |
3941 factory Class(a, b) = Unresolved; | 3711 factory Class(a, b) = Unresolved; |
3942 } | 3712 } |
3943 m() => new Class(true, 42); | 3713 m() => new Class(true, 42); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3991 arguments: '(true,42)', | 3761 arguments: '(true,42)', |
3992 type: 'Class', | 3762 type: 'Class', |
3993 selector: 'CallStructure(arity=2)')), | 3763 selector: 'CallStructure(arity=2)')), |
3994 ], | 3764 ], |
3995 'If not null expressions': const [ | 3765 'If not null expressions': const [ |
3996 const Test( | 3766 const Test( |
3997 ''' | 3767 ''' |
3998 m(a) => a?.b; | 3768 m(a) => a?.b; |
3999 ''', | 3769 ''', |
4000 const [ | 3770 const [ |
4001 const Visit( | 3771 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET, |
4002 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET, | 3772 receiver: 'a', name: 'b'), |
4003 receiver: 'a', | 3773 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4004 name: 'b'), | |
4005 const Visit( | |
4006 VisitKind.VISIT_PARAMETER_GET, | |
4007 element: 'parameter(m#a)'), | |
4008 ]), | 3774 ]), |
4009 const Test( | 3775 const Test( |
4010 ''' | 3776 ''' |
4011 class C { | 3777 class C { |
4012 static var b; | 3778 static var b; |
4013 } | 3779 } |
4014 m(a) => C?.b; | 3780 m(a) => C?.b; |
4015 ''', | 3781 ''', |
4016 const Visit( | 3782 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: 'field(C#b)')), |
4017 VisitKind.VISIT_STATIC_FIELD_GET, | |
4018 element: 'field(C#b)')), | |
4019 const Test( | 3783 const Test( |
4020 ''' | 3784 ''' |
4021 m(a) => a?.b = 42; | 3785 m(a) => a?.b = 42; |
4022 ''', | 3786 ''', |
4023 const [ | 3787 const [ |
4024 const Visit( | 3788 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET, |
4025 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET, | 3789 receiver: 'a', name: 'b', rhs: '42'), |
4026 receiver: 'a', | 3790 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4027 name: 'b', | |
4028 rhs: '42'), | |
4029 const Visit( | |
4030 VisitKind.VISIT_PARAMETER_GET, | |
4031 element: 'parameter(m#a)'), | |
4032 ]), | 3791 ]), |
4033 const Test( | 3792 const Test( |
4034 ''' | 3793 ''' |
4035 m(a) => a?.b(42, true); | 3794 m(a) => a?.b(42, true); |
4036 ''', | 3795 ''', |
4037 const [ | 3796 const [ |
4038 const Visit( | 3797 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_INVOKE, |
4039 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_INVOKE, | |
4040 receiver: 'a', | 3798 receiver: 'a', |
4041 arguments: '(42,true)', | 3799 arguments: '(42,true)', |
4042 selector: 'Selector(call, b, arity=2)'), | 3800 selector: 'Selector(call, b, arity=2)'), |
4043 const Visit( | 3801 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4044 VisitKind.VISIT_PARAMETER_GET, | |
4045 element: 'parameter(m#a)'), | |
4046 ]), | 3802 ]), |
4047 const Test( | 3803 const Test( |
4048 ''' | 3804 ''' |
4049 m(a) => ++a?.b; | 3805 m(a) => ++a?.b; |
4050 ''', | 3806 ''', |
4051 const [ | 3807 const [ |
4052 const Visit( | 3808 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX, |
4053 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX, | |
4054 receiver: 'a', name: 'b', operator: '++'), | 3809 receiver: 'a', name: 'b', operator: '++'), |
4055 const Visit( | 3810 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4056 VisitKind.VISIT_PARAMETER_GET, | |
4057 element: 'parameter(m#a)'), | |
4058 ]), | 3811 ]), |
4059 const Test( | 3812 const Test( |
4060 ''' | 3813 ''' |
4061 m(a) => a?.b--; | 3814 m(a) => a?.b--; |
4062 ''', | 3815 ''', |
4063 const [ | 3816 const [ |
4064 const Visit( | 3817 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX, |
4065 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX, | |
4066 receiver: 'a', name: 'b', operator: '--'), | 3818 receiver: 'a', name: 'b', operator: '--'), |
4067 const Visit( | 3819 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4068 VisitKind.VISIT_PARAMETER_GET, | |
4069 element: 'parameter(m#a)'), | |
4070 ]), | 3820 ]), |
4071 const Test( | 3821 const Test( |
4072 ''' | 3822 ''' |
4073 m(a) => a?.b *= 42; | 3823 m(a) => a?.b *= 42; |
4074 ''', | 3824 ''', |
4075 const [ | 3825 const [ |
4076 const Visit( | 3826 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_COMPOUND, |
4077 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_COMPOUND, | |
4078 receiver: 'a', name: 'b', operator: '*=', rhs: '42'), | 3827 receiver: 'a', name: 'b', operator: '*=', rhs: '42'), |
4079 const Visit( | 3828 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4080 VisitKind.VISIT_PARAMETER_GET, | |
4081 element: 'parameter(m#a)'), | |
4082 ]), | 3829 ]), |
4083 const Test( | 3830 const Test( |
4084 ''' | 3831 ''' |
4085 m(a) => a?.b ??= 42; | 3832 m(a) => a?.b ??= 42; |
4086 ''', | 3833 ''', |
4087 const [ | 3834 const [ |
4088 const Visit( | 3835 const Visit(VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET_IF_NULL, |
4089 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET_IF_NULL, | |
4090 receiver: 'a', name: 'b', rhs: '42'), | 3836 receiver: 'a', name: 'b', rhs: '42'), |
4091 const Visit( | 3837 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4092 VisitKind.VISIT_PARAMETER_GET, | |
4093 element: 'parameter(m#a)'), | |
4094 ]), | 3838 ]), |
4095 const Test( | 3839 const Test( |
4096 ''' | 3840 ''' |
4097 m(a, b) => a ?? b; | 3841 m(a, b) => a ?? b; |
4098 ''', | 3842 ''', |
4099 const [ | 3843 const [ |
4100 const Visit(VisitKind.VISIT_IF_NULL, | 3844 const Visit(VisitKind.VISIT_IF_NULL, left: 'a', right: 'b'), |
4101 left: 'a', right: 'b'), | 3845 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)'), |
4102 const Visit( | 3846 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#b)'), |
4103 VisitKind.VISIT_PARAMETER_GET, | 3847 ]), |
4104 element: 'parameter(m#a)'), | |
4105 const Visit( | |
4106 VisitKind.VISIT_PARAMETER_GET, | |
4107 element: 'parameter(m#b)'), | |
4108 ]), | |
4109 const Test( | 3848 const Test( |
4110 ''' | 3849 ''' |
4111 m(a) => a ??= 42; | 3850 m(a) => a ??= 42; |
4112 ''', | 3851 ''', |
4113 const Visit( | 3852 const Visit(VisitKind.VISIT_PARAMETER_SET_IF_NULL, |
4114 VisitKind.VISIT_PARAMETER_SET_IF_NULL, | 3853 element: 'parameter(m#a)', rhs: '42')), |
4115 element: 'parameter(m#a)', | |
4116 rhs: '42')), | |
4117 const Test.prefix( | 3854 const Test.prefix( |
4118 ''' | 3855 ''' |
4119 var o; | 3856 var o; |
4120 ''', | 3857 ''', |
4121 'm() => p?.o;', | 3858 'm() => p?.o;', |
4122 const Visit(VisitKind.ERROR_INVALID_GET, | 3859 const Visit(VisitKind.ERROR_INVALID_GET, |
4123 error: MessageKind.PREFIX_AS_EXPRESSION)), | 3860 error: MessageKind.PREFIX_AS_EXPRESSION)), |
4124 ], | 3861 ], |
4125 'Set if null': const [ | 3862 'Set if null': const [ |
4126 const Test( | 3863 const Test( |
4127 ''' | 3864 ''' |
4128 m(a) => a.b ??= 42; | 3865 m(a) => a.b ??= 42; |
4129 ''', | 3866 ''', |
4130 const [ | 3867 const [ |
4131 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET_IF_NULL, | 3868 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET_IF_NULL, |
4132 receiver: 'a', name: 'b', rhs: '42'), | 3869 receiver: 'a', name: 'b', rhs: '42'), |
4133 const Visit(VisitKind.VISIT_PARAMETER_GET, | 3870 const Visit(VisitKind.VISIT_PARAMETER_GET, element: 'parameter(m#a)') |
4134 element: 'parameter(m#a)') | |
4135 ]), | 3871 ]), |
4136 const Test( | 3872 const Test( |
4137 ''' | 3873 ''' |
4138 m(a) => a ??= 42; | 3874 m(a) => a ??= 42; |
4139 ''', | 3875 ''', |
4140 const Visit(VisitKind.VISIT_PARAMETER_SET_IF_NULL, | 3876 const Visit(VisitKind.VISIT_PARAMETER_SET_IF_NULL, |
4141 element: 'parameter(m#a)', rhs: '42')), | 3877 element: 'parameter(m#a)', rhs: '42')), |
4142 const Test( | 3878 const Test( |
4143 ''' | 3879 ''' |
4144 m(final a) => a ??= 42; | 3880 m(final a) => a ??= 42; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 ''', | 3915 ''', |
4180 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET_IF_NULL, | 3916 const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET_IF_NULL, |
4181 element: 'field(a)', rhs: '42')), | 3917 element: 'field(a)', rhs: '42')), |
4182 const Test( | 3918 const Test( |
4183 ''' | 3919 ''' |
4184 get a => 0; | 3920 get a => 0; |
4185 set a(_) {} | 3921 set a(_) {} |
4186 m() => a ??= 42; | 3922 m() => a ??= 42; |
4187 ''', | 3923 ''', |
4188 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_SET_IF_NULL, | 3924 const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_SET_IF_NULL, |
4189 getter: 'getter(a)', setter: 'setter(a)', | 3925 getter: 'getter(a)', setter: 'setter(a)', rhs: '42')), |
4190 rhs: '42')), | |
4191 const Test( | 3926 const Test( |
4192 ''' | 3927 ''' |
4193 class C { | 3928 class C { |
4194 static var a; | 3929 static var a; |
4195 } | 3930 } |
4196 m() => C.a ??= 42; | 3931 m() => C.a ??= 42; |
4197 ''', | 3932 ''', |
4198 const Visit(VisitKind.VISIT_STATIC_FIELD_SET_IF_NULL, | 3933 const Visit(VisitKind.VISIT_STATIC_FIELD_SET_IF_NULL, |
4199 element: 'field(C#a)', rhs: '42')), | 3934 element: 'field(C#a)', rhs: '42')), |
4200 const Test.clazz( | 3935 const Test.clazz( |
(...skipping 26 matching lines...) Expand all Loading... |
4227 const Visit(VisitKind.VISIT_STATIC_FIELD_SET_IF_NULL, | 3962 const Visit(VisitKind.VISIT_STATIC_FIELD_SET_IF_NULL, |
4228 element: 'field(C#a)', rhs: '42')), | 3963 element: 'field(C#a)', rhs: '42')), |
4229 const Test.clazz( | 3964 const Test.clazz( |
4230 ''' | 3965 ''' |
4231 class C { | 3966 class C { |
4232 var o; | 3967 var o; |
4233 static m() { o ??= 42; } | 3968 static m() { o ??= 42; } |
4234 } | 3969 } |
4235 ''', | 3970 ''', |
4236 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, | 3971 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
4237 error: MessageKind.NO_INSTANCE_AVAILABLE, | 3972 error: MessageKind.NO_INSTANCE_AVAILABLE, rhs: '42')), |
4238 rhs: '42')), | |
4239 const Test.prefix( | 3973 const Test.prefix( |
4240 ''' | 3974 ''' |
4241 ''', | 3975 ''', |
4242 ''' | 3976 ''' |
4243 m() { p ??= 42; } | 3977 m() { p ??= 42; } |
4244 ''', | 3978 ''', |
4245 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, | 3979 const Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, |
4246 error: MessageKind.PREFIX_AS_EXPRESSION, | 3980 error: MessageKind.PREFIX_AS_EXPRESSION, rhs: '42')), |
4247 rhs: '42')), | |
4248 const Test( | 3981 const Test( |
4249 ''' | 3982 ''' |
4250 class C { | 3983 class C { |
4251 static get a => 0; | 3984 static get a => 0; |
4252 static set a(_) {} | 3985 static set a(_) {} |
4253 } | 3986 } |
4254 m() => C.a ??= 42; | 3987 m() => C.a ??= 42; |
4255 ''', | 3988 ''', |
4256 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, | 3989 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, |
4257 getter: 'getter(C#a)', setter: 'setter(C#a)', | 3990 getter: 'getter(C#a)', setter: 'setter(C#a)', rhs: '42')), |
4258 rhs: '42')), | |
4259 const Test.clazz( | 3991 const Test.clazz( |
4260 ''' | 3992 ''' |
4261 class C { | 3993 class C { |
4262 static get a => 0; | 3994 static get a => 0; |
4263 static set a(_) {} | 3995 static set a(_) {} |
4264 m() => C.a ??= 42; | 3996 m() => C.a ??= 42; |
4265 } | 3997 } |
4266 ''', | 3998 ''', |
4267 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, | 3999 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, |
4268 getter: 'getter(C#a)', setter: 'setter(C#a)', | 4000 getter: 'getter(C#a)', setter: 'setter(C#a)', rhs: '42')), |
4269 rhs: '42')), | |
4270 const Test.clazz( | 4001 const Test.clazz( |
4271 ''' | 4002 ''' |
4272 class C { | 4003 class C { |
4273 static get a => 0; | 4004 static get a => 0; |
4274 static set a(_) {} | 4005 static set a(_) {} |
4275 m() => a ??= 42; | 4006 m() => a ??= 42; |
4276 } | 4007 } |
4277 ''', | 4008 ''', |
4278 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, | 4009 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, |
4279 getter: 'getter(C#a)', setter: 'setter(C#a)', | 4010 getter: 'getter(C#a)', setter: 'setter(C#a)', rhs: '42')), |
4280 rhs: '42')), | |
4281 const Test.prefix( | 4011 const Test.prefix( |
4282 ''' | 4012 ''' |
4283 class C { | 4013 class C { |
4284 static get a => 0; | 4014 static get a => 0; |
4285 static set a(_) {} | 4015 static set a(_) {} |
4286 } | 4016 } |
4287 ''', | 4017 ''', |
4288 ''' | 4018 ''' |
4289 m() => p.C.a ??= 42; | 4019 m() => p.C.a ??= 42; |
4290 ''', | 4020 ''', |
4291 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, | 4021 const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_SET_IF_NULL, |
4292 getter: 'getter(C#a)', setter: 'setter(C#a)', | 4022 getter: 'getter(C#a)', setter: 'setter(C#a)', rhs: '42')), |
4293 rhs: '42')), | |
4294 // TODO(johnniwinther): Enable these when dart2js supports method and setter | 4023 // TODO(johnniwinther): Enable these when dart2js supports method and setter |
4295 // with the same name. | 4024 // with the same name. |
4296 /*const Test( | 4025 /*const Test( |
4297 ''' | 4026 ''' |
4298 class C { | 4027 class C { |
4299 static a() {} | 4028 static a() {} |
4300 static set a(_) {} | 4029 static set a(_) {} |
4301 } | 4030 } |
4302 m() => C.a ??= 42; | 4031 m() => C.a ??= 42; |
4303 ''', | 4032 ''', |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4383 ''' | 4112 ''' |
4384 class B { | 4113 class B { |
4385 get a => 0; | 4114 get a => 0; |
4386 set a (_) {} | 4115 set a (_) {} |
4387 } | 4116 } |
4388 class C extends B { | 4117 class C extends B { |
4389 m() => super.a ??= 42; | 4118 m() => super.a ??= 42; |
4390 } | 4119 } |
4391 ''', | 4120 ''', |
4392 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_SET_IF_NULL, | 4121 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_SET_IF_NULL, |
4393 getter: 'getter(B#a)', setter: 'setter(B#a)', | 4122 getter: 'getter(B#a)', setter: 'setter(B#a)', rhs: '42')), |
4394 rhs: '42')), | |
4395 const Test.clazz( | 4123 const Test.clazz( |
4396 ''' | 4124 ''' |
4397 class A { | 4125 class A { |
4398 get a => 0; | 4126 get a => 0; |
4399 } | 4127 } |
4400 class B extends A { | 4128 class B extends A { |
4401 set a (_) {} | 4129 set a (_) {} |
4402 } | 4130 } |
4403 class C extends B { | 4131 class C extends B { |
4404 m() => super.a ??= 42; | 4132 m() => super.a ??= 42; |
4405 } | 4133 } |
4406 ''', | 4134 ''', |
4407 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_SET_IF_NULL, | 4135 const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_SET_IF_NULL, |
4408 getter: 'getter(A#a)', setter: 'setter(B#a)', | 4136 getter: 'getter(A#a)', setter: 'setter(B#a)', rhs: '42')), |
4409 rhs: '42')), | |
4410 const Test.clazz( | 4137 const Test.clazz( |
4411 ''' | 4138 ''' |
4412 class A { | 4139 class A { |
4413 var a; | 4140 var a; |
4414 } | 4141 } |
4415 class B extends A { | 4142 class B extends A { |
4416 get a => 0; | 4143 get a => 0; |
4417 } | 4144 } |
4418 | 4145 |
4419 class C extends B { | 4146 class C extends B { |
4420 m() => super.a ??= 42; | 4147 m() => super.a ??= 42; |
4421 } | 4148 } |
4422 ''', | 4149 ''', |
4423 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_SET_IF_NULL, | 4150 const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_SET_IF_NULL, |
4424 getter: 'getter(B#a)', setter: 'field(A#a)', | 4151 getter: 'getter(B#a)', setter: 'field(A#a)', rhs: '42')), |
4425 rhs: '42')), | |
4426 const Test.clazz( | 4152 const Test.clazz( |
4427 ''' | 4153 ''' |
4428 class A { | 4154 class A { |
4429 var a; | 4155 var a; |
4430 } | 4156 } |
4431 class B extends A { | 4157 class B extends A { |
4432 set a(_) {} | 4158 set a(_) {} |
4433 } | 4159 } |
4434 | 4160 |
4435 class C extends B { | 4161 class C extends B { |
4436 m() => super.a ??= 42; | 4162 m() => super.a ??= 42; |
4437 } | 4163 } |
4438 ''', | 4164 ''', |
4439 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_SET_IF_NULL, | 4165 const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_SET_IF_NULL, |
4440 getter: 'field(A#a)', setter: 'setter(B#a)', | 4166 getter: 'field(A#a)', setter: 'setter(B#a)', rhs: '42')), |
4441 rhs: '42')), | |
4442 const Test.clazz( | 4167 const Test.clazz( |
4443 ''' | 4168 ''' |
4444 class A { | 4169 class A { |
4445 var a; | 4170 var a; |
4446 } | 4171 } |
4447 class B extends A { | 4172 class B extends A { |
4448 final a = 0; | 4173 final a = 0; |
4449 } | 4174 } |
4450 | 4175 |
4451 class C extends B { | 4176 class C extends B { |
4452 m() => super.a ??= 42; | 4177 m() => super.a ??= 42; |
4453 } | 4178 } |
4454 ''', | 4179 ''', |
4455 // TODO(johnniwinther): Change this to | 4180 // TODO(johnniwinther): Change this to |
4456 // [VISIT_SUPER_FIELD_FIELD_SET_IF_NULL] when dart2js supports shadow | 4181 // [VISIT_SUPER_FIELD_FIELD_SET_IF_NULL] when dart2js supports shadow |
4457 // setters. | 4182 // setters. |
4458 const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_SET_IF_NULL, | 4183 const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_SET_IF_NULL, |
4459 element: 'field(B#a)', | 4184 element: 'field(B#a)', rhs: '42')), |
4460 rhs: '42')), | |
4461 const Test.clazz( | 4185 const Test.clazz( |
4462 ''' | 4186 ''' |
4463 class B { | 4187 class B { |
4464 a() {} | 4188 a() {} |
4465 } | 4189 } |
4466 class C extends B { | 4190 class C extends B { |
4467 m() => super.a ??= 42; | 4191 m() => super.a ??= 42; |
4468 } | 4192 } |
4469 ''', | 4193 ''', |
4470 const Visit(VisitKind.VISIT_SUPER_METHOD_SET_IF_NULL, | 4194 const Visit(VisitKind.VISIT_SUPER_METHOD_SET_IF_NULL, |
4471 element: 'function(B#a)', | 4195 element: 'function(B#a)', rhs: '42')), |
4472 rhs: '42')), | |
4473 const Test.clazz( | 4196 const Test.clazz( |
4474 ''' | 4197 ''' |
4475 class B { | 4198 class B { |
4476 } | 4199 } |
4477 class C extends B { | 4200 class C extends B { |
4478 m() => super.a ??= 42; | 4201 m() => super.a ??= 42; |
4479 } | 4202 } |
4480 ''', | 4203 ''', |
4481 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SET_IF_NULL, | 4204 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SET_IF_NULL, |
4482 name: 'a', rhs: '42')), | 4205 name: 'a', rhs: '42')), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4576 element: 'field(a)', rhs: '42')), | 4299 element: 'field(a)', rhs: '42')), |
4577 | 4300 |
4578 const Test( | 4301 const Test( |
4579 ''' | 4302 ''' |
4580 m() => unresolved ??= 42; | 4303 m() => unresolved ??= 42; |
4581 ''', | 4304 ''', |
4582 const Visit(VisitKind.VISIT_UNRESOLVED_SET_IF_NULL, | 4305 const Visit(VisitKind.VISIT_UNRESOLVED_SET_IF_NULL, |
4583 name: 'unresolved', rhs: '42')), | 4306 name: 'unresolved', rhs: '42')), |
4584 ], | 4307 ], |
4585 }; | 4308 }; |
OLD | NEW |