OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import "../elements/elements.dart" | 7 import "../elements/elements.dart" |
8 show | 8 show |
9 AstElement, | 9 AstElement, |
10 ConstructorElement, | 10 ConstructorElement, |
11 Element, | 11 Element, |
12 ErroneousElement, | 12 ErroneousElement, |
13 FunctionElement, | 13 FunctionElement, |
14 MethodElement; | 14 GetterElement, |
| 15 MethodElement, |
| 16 SetterElement; |
15 import "../elements/operators.dart" | 17 import "../elements/operators.dart" |
16 show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator; | 18 show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator; |
17 import "../elements/resolution_types.dart" | 19 import "../elements/resolution_types.dart" |
18 show ResolutionDartType, ResolutionInterfaceType; | 20 show ResolutionDartType, ResolutionInterfaceType; |
19 import "../tree/tree.dart" show Expression, NewExpression, Node, NodeList, Send; | 21 import "../tree/tree.dart" |
| 22 show Expression, NewExpression, Node, NodeList, Send, SendSet; |
20 import "../universe/call_structure.dart" show CallStructure; | 23 import "../universe/call_structure.dart" show CallStructure; |
21 import "../universe/selector.dart" show Selector; | 24 import "../universe/selector.dart" show Selector; |
22 import 'accessors.dart'; | 25 import 'accessors.dart'; |
23 import "kernel.dart" show Kernel; | 26 import "kernel.dart" show Kernel; |
24 | 27 |
25 abstract class UnresolvedVisitor { | 28 abstract class UnresolvedVisitor { |
26 Kernel get kernel; | 29 Kernel get kernel; |
27 | 30 |
28 // Implemented in KernelVisitor | 31 // Implemented in KernelVisitor |
29 AstElement get currentElement; | 32 AstElement get currentElement; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 NodeList arguments, | 180 NodeList arguments, |
178 Selector selector, | 181 Selector selector, |
179 _) { | 182 _) { |
180 ir.Expression receiver = new ir.TypeLiteral(kernel.interfaceTypeToIr(type)); | 183 ir.Expression receiver = new ir.TypeLiteral(kernel.interfaceTypeToIr(type)); |
181 String methodName = | 184 String methodName = |
182 node.send.selector != null ? '${node.send.selector}' : type.name; | 185 node.send.selector != null ? '${node.send.selector}' : type.name; |
183 return buildThrowNoSuchMethodError(kernel.getUnresolvedConstructorBuilder(), | 186 return buildThrowNoSuchMethodError(kernel.getUnresolvedConstructorBuilder(), |
184 receiver, methodName, buildArguments(arguments), constructor); | 187 receiver, methodName, buildArguments(arguments), constructor); |
185 } | 188 } |
186 | 189 |
187 ir.Expression visitUnresolvedCompound( | 190 ir.Expression visitUnresolvedCompound(Send node, ErroneousElement element, |
188 Send node, Element element, AssignmentOperator operator, Node rhs, _) { | 191 AssignmentOperator operator, Node rhs, _) { |
189 return buildThrowUnresolvedGetter('${node.selector}'); | 192 return buildThrowUnresolvedGetter('${node.selector}'); |
190 } | 193 } |
191 | 194 |
192 ir.Expression visitUnresolvedGet(Send node, Element element, _) { | 195 ir.Expression visitUnresolvedGet(Send node, Element element, _) { |
193 return buildThrowUnresolvedGetter('${node.selector}'); | 196 return buildThrowUnresolvedGetter('${node.selector}'); |
194 } | 197 } |
195 | 198 |
196 ir.Expression visitUnresolvedInvoke( | 199 ir.Expression visitUnresolvedInvoke( |
197 Send node, Element element, NodeList arguments, Selector selector, _) { | 200 Send node, Element element, NodeList arguments, Selector selector, _) { |
198 // TODO(asgerf): Should we use a type literal as receiver for unresolved | 201 // TODO(asgerf): Should we use a type literal as receiver for unresolved |
199 // static invocations? | 202 // static invocations? |
200 return buildThrowNoSuchMethodError(kernel.getGenericNoSuchMethodBuilder(), | 203 return buildThrowNoSuchMethodError(kernel.getGenericNoSuchMethodBuilder(), |
201 new ir.NullLiteral(), element.name, buildArguments(arguments), element); | 204 new ir.NullLiteral(), element.name, buildArguments(arguments), element); |
202 } | 205 } |
203 | 206 |
204 ir.Expression visitUnresolvedPostfix( | 207 ir.Expression visitUnresolvedPostfix( |
205 Send node, Element element, IncDecOperator operator, _) { | 208 Send node, ErroneousElement element, IncDecOperator operator, _) { |
206 return buildThrowUnresolvedGetter('${node.selector}'); | 209 return buildThrowUnresolvedGetter('${node.selector}'); |
207 } | 210 } |
208 | 211 |
209 ir.Expression visitUnresolvedPrefix( | 212 ir.Expression visitUnresolvedPrefix( |
210 Send node, Element element, IncDecOperator operator, _) { | 213 Send node, ErroneousElement element, IncDecOperator operator, _) { |
211 return buildThrowUnresolvedGetter('${node.selector}'); | 214 return buildThrowUnresolvedGetter('${node.selector}'); |
212 } | 215 } |
213 | 216 |
214 ir.Expression visitUnresolvedRedirectingFactoryConstructorInvoke( | 217 ir.Expression visitUnresolvedRedirectingFactoryConstructorInvoke( |
215 NewExpression node, | 218 NewExpression node, |
216 ConstructorElement constructor, | 219 ConstructorElement constructor, |
217 ResolutionInterfaceType type, | 220 ResolutionInterfaceType type, |
218 NodeList arguments, | 221 NodeList arguments, |
219 CallStructure callStructure, | 222 CallStructure callStructure, |
220 _) { | 223 _) { |
221 // The body of the factory will throw an error. | 224 // The body of the factory will throw an error. |
222 return new ir.StaticInvocation( | 225 return new ir.StaticInvocation( |
223 possiblyErroneousFunctionToIr(constructor), buildArguments(arguments)); | 226 possiblyErroneousFunctionToIr(constructor), buildArguments(arguments)); |
224 } | 227 } |
225 | 228 |
226 ir.Expression visitUnresolvedSet(Send node, Element element, Node rhs, _) { | 229 ir.Expression visitUnresolvedSet(SendSet node, Element element, Node rhs, _) { |
227 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs)); | 230 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs)); |
228 } | 231 } |
229 | 232 |
230 ir.Expression visitUnresolvedSetIfNull( | 233 ir.Expression visitUnresolvedSetIfNull( |
231 Send node, Element element, Node rhs, _) { | 234 Send node, Element element, Node rhs, _) { |
232 return buildThrowUnresolvedGetter('${node.selector}'); | 235 return buildThrowUnresolvedGetter('${node.selector}'); |
233 } | 236 } |
234 | 237 |
235 ir.Expression visitUnresolvedStaticGetterCompound(Send node, Element element, | 238 ir.Expression visitUnresolvedStaticGetterCompound(Send node, Element element, |
236 MethodElement setter, AssignmentOperator operator, Node rhs, _) { | 239 MethodElement setter, AssignmentOperator operator, Node rhs, _) { |
(...skipping 14 matching lines...) Expand all Loading... |
251 } | 254 } |
252 | 255 |
253 ir.Expression visitUnresolvedStaticGetterSetIfNull( | 256 ir.Expression visitUnresolvedStaticGetterSetIfNull( |
254 Send node, Element element, MethodElement setter, Node rhs, _) { | 257 Send node, Element element, MethodElement setter, Node rhs, _) { |
255 return buildThrowUnresolvedGetter( | 258 return buildThrowUnresolvedGetter( |
256 '${node.selector}', kernel.getUnresolvedStaticGetterBuilder()); | 259 '${node.selector}', kernel.getUnresolvedStaticGetterBuilder()); |
257 } | 260 } |
258 | 261 |
259 ir.Expression visitUnresolvedStaticSetterCompound( | 262 ir.Expression visitUnresolvedStaticSetterCompound( |
260 Send node, | 263 Send node, |
261 MethodElement getter, | 264 GetterElement getter, |
262 Element element, | 265 Element element, |
263 AssignmentOperator operator, | 266 AssignmentOperator operator, |
264 Node rhs, | 267 Node rhs, |
265 _) { | 268 _) { |
266 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs), | 269 return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs), |
267 kernel.getUnresolvedStaticSetterBuilder()); | 270 kernel.getUnresolvedStaticSetterBuilder()); |
268 } | 271 } |
269 | 272 |
270 ir.Expression visitUnresolvedStaticSetterPostfix(Send node, | 273 ir.Expression visitUnresolvedStaticSetterPostfix(Send node, |
271 MethodElement getter, Element element, IncDecOperator operator, _) { | 274 GetterElement getter, Element element, IncDecOperator operator, _) { |
272 var accessor = new ClassStaticAccessor( | 275 var accessor = new ClassStaticAccessor( |
273 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 276 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
274 var result = accessor.buildPostfixIncrement( | 277 var result = accessor.buildPostfixIncrement( |
275 new ir.Name(operator.selectorName), | 278 new ir.Name(operator.selectorName), |
276 voidContext: isVoidContext); | 279 voidContext: isVoidContext); |
277 associateCompoundComponents(accessor, node); | 280 associateCompoundComponents(accessor, node); |
278 return result; | 281 return result; |
279 } | 282 } |
280 | 283 |
281 ir.Expression visitUnresolvedStaticSetterPrefix(Send node, | 284 ir.Expression visitUnresolvedStaticSetterPrefix(Send node, |
282 MethodElement getter, Element element, IncDecOperator operator, _) { | 285 GetterElement getter, Element element, IncDecOperator operator, _) { |
283 var accessor = new ClassStaticAccessor( | 286 var accessor = new ClassStaticAccessor( |
284 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 287 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
285 var result = accessor.buildPrefixIncrement( | 288 var result = accessor.buildPrefixIncrement( |
286 new ir.Name(operator.selectorName), | 289 new ir.Name(operator.selectorName), |
287 voidContext: isVoidContext); | 290 voidContext: isVoidContext); |
288 associateCompoundComponents(accessor, node); | 291 associateCompoundComponents(accessor, node); |
289 return result; | 292 return result; |
290 } | 293 } |
291 | 294 |
292 ir.Expression visitUnresolvedStaticSetterSetIfNull( | 295 ir.Expression visitUnresolvedStaticSetterSetIfNull( |
293 Send node, MethodElement getter, Element element, Node rhs, _) { | 296 Send node, GetterElement getter, Element element, Node rhs, _) { |
294 var accessor = new ClassStaticAccessor( | 297 var accessor = new ClassStaticAccessor( |
295 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 298 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
296 return accessor.buildNullAwareAssignment(visitForValue(rhs), null, | 299 return accessor.buildNullAwareAssignment(visitForValue(rhs), null, |
297 voidContext: isVoidContext); | 300 voidContext: isVoidContext); |
298 } | 301 } |
299 | 302 |
300 ir.Expression visitUnresolvedSuperBinary( | 303 ir.Expression visitUnresolvedSuperBinary( |
301 Send node, Element element, BinaryOperator operator, Node argument, _) { | 304 Send node, Element element, BinaryOperator operator, Node argument, _) { |
302 // TODO(sra): This is incorrect when the superclass defines noSuchMethod. | 305 // TODO(sra): This is incorrect when the superclass defines noSuchMethod. |
303 return buildThrowNoSuchMethodError( | 306 return buildThrowNoSuchMethodError( |
304 kernel.getUnresolvedSuperMethodBuilder(), | 307 kernel.getUnresolvedSuperMethodBuilder(), |
305 new ir.ThisExpression(), | 308 new ir.ThisExpression(), |
306 operator.selectorName, | 309 operator.selectorName, |
307 new ir.Arguments(<ir.Expression>[visitForValue(argument)])); | 310 new ir.Arguments(<ir.Expression>[visitForValue(argument)])); |
308 } | 311 } |
309 | 312 |
310 ir.Expression visitUnresolvedSuperCompound( | 313 ir.Expression visitUnresolvedSuperCompound( |
311 Send node, Element element, AssignmentOperator operator, Node rhs, _) { | 314 Send node, Element element, AssignmentOperator operator, Node rhs, _) { |
312 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 315 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
313 } | 316 } |
314 | 317 |
315 ir.Expression visitUnresolvedSuperCompoundIndexSet(Send node, Element element, | 318 ir.Expression visitUnresolvedSuperCompoundIndexSet(SendSet node, |
316 Node index, AssignmentOperator operator, Node rhs, _) { | 319 Element element, Node index, AssignmentOperator operator, Node rhs, _) { |
317 return buildUnresolvedSuperIndexAccessor(index, element) | 320 return buildUnresolvedSuperIndexAccessor(index, element) |
318 .buildCompoundAssignment( | 321 .buildCompoundAssignment( |
319 new ir.Name(operator.selectorName), visitForValue(rhs)); | 322 new ir.Name(operator.selectorName), visitForValue(rhs)); |
320 } | 323 } |
321 | 324 |
322 ir.Expression visitUnresolvedSuperGet(Send node, Element element, _) { | 325 ir.Expression visitUnresolvedSuperGet(Send node, Element element, _) { |
323 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 326 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
324 } | 327 } |
325 | 328 |
326 ir.Expression visitUnresolvedSuperGetterCompound(Send node, Element element, | 329 ir.Expression visitUnresolvedSuperGetterCompound( |
327 MethodElement setter, AssignmentOperator operator, Node rhs, _) { | 330 SendSet node, |
| 331 Element element, |
| 332 SetterElement setter, |
| 333 AssignmentOperator operator, |
| 334 Node rhs, |
| 335 _) { |
328 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 336 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
329 } | 337 } |
330 | 338 |
331 ir.Expression visitUnresolvedSuperGetterCompoundIndexSet( | 339 ir.Expression visitUnresolvedSuperGetterCompoundIndexSet( |
332 Send node, | 340 SendSet node, |
333 Element element, | 341 Element element, |
334 MethodElement setter, | 342 MethodElement setter, |
335 Node index, | 343 Node index, |
336 AssignmentOperator operator, | 344 AssignmentOperator operator, |
337 Node rhs, | 345 Node rhs, |
338 _) { | 346 _) { |
339 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 347 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
340 } | 348 } |
341 | 349 |
342 ir.Expression visitUnresolvedSuperGetterIndexPostfix( | 350 ir.Expression visitUnresolvedSuperGetterIndexPostfix( |
343 Send node, | 351 SendSet node, |
344 Element element, | 352 Element element, |
345 MethodElement setter, | 353 MethodElement setter, |
346 Node index, | 354 Node index, |
347 IncDecOperator operator, | 355 IncDecOperator operator, |
348 _) { | 356 _) { |
349 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 357 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
350 } | 358 } |
351 | 359 |
352 ir.Expression visitUnresolvedSuperGetterIndexPrefix( | 360 ir.Expression visitUnresolvedSuperGetterIndexPrefix( |
353 Send node, | 361 SendSet node, |
354 Element element, | 362 Element element, |
355 MethodElement setter, | 363 MethodElement setter, |
356 Node index, | 364 Node index, |
357 IncDecOperator operator, | 365 IncDecOperator operator, |
358 _) { | 366 _) { |
359 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 367 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
360 } | 368 } |
361 | 369 |
362 ir.Expression visitUnresolvedSuperGetterPostfix(Send node, Element element, | 370 ir.Expression visitUnresolvedSuperGetterPostfix(SendSet node, Element element, |
363 MethodElement setter, IncDecOperator operator, _) { | 371 SetterElement setter, IncDecOperator operator, _) { |
364 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 372 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
365 } | 373 } |
366 | 374 |
367 ir.Expression visitUnresolvedSuperGetterPrefix(Send node, Element element, | 375 ir.Expression visitUnresolvedSuperGetterPrefix(SendSet node, Element element, |
368 MethodElement setter, IncDecOperator operator, _) { | 376 SetterElement setter, IncDecOperator operator, _) { |
369 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 377 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
370 } | 378 } |
371 | 379 |
372 ir.Expression visitUnresolvedSuperGetterSetIfNull( | 380 ir.Expression visitUnresolvedSuperGetterSetIfNull( |
373 Send node, Element element, MethodElement setter, Node rhs, _) { | 381 Send node, Element element, MethodElement setter, Node rhs, _) { |
374 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 382 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
375 } | 383 } |
376 | 384 |
377 ir.Expression visitUnresolvedSuperIndex( | 385 ir.Expression visitUnresolvedSuperIndex( |
378 Send node, Element element, Node index, _) { | 386 Send node, Element element, Node index, _) { |
379 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); | 387 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); |
380 } | 388 } |
381 | 389 |
382 ir.Expression visitUnresolvedSuperIndexPostfix( | 390 ir.Expression visitUnresolvedSuperIndexPostfix( |
383 Send node, Element element, Node index, IncDecOperator operator, _) { | 391 Send node, Element element, Node index, IncDecOperator operator, _) { |
384 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); | 392 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); |
385 } | 393 } |
386 | 394 |
387 ir.Expression visitUnresolvedSuperIndexPrefix( | 395 ir.Expression visitUnresolvedSuperIndexPrefix( |
388 Send node, Element element, Node index, IncDecOperator operator, _) { | 396 Send node, Element element, Node index, IncDecOperator operator, _) { |
389 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); | 397 return buildUnresolvedSuperIndexAccessor(index, element).buildSimpleRead(); |
390 } | 398 } |
391 | 399 |
392 ir.Expression visitUnresolvedSuperIndexSet( | 400 ir.Expression visitUnresolvedSuperIndexSet( |
393 Send node, Element element, Node index, Node rhs, _) { | 401 SendSet node, ErroneousElement element, Node index, Node rhs, _) { |
394 return buildUnresolvedSuperIndexAccessor(index, element) | 402 return buildUnresolvedSuperIndexAccessor(index, element) |
395 .buildAssignment(visitForValue(rhs)); | 403 .buildAssignment(visitForValue(rhs)); |
396 } | 404 } |
397 | 405 |
398 ir.Expression visitUnresolvedSuperInvoke( | 406 ir.Expression visitUnresolvedSuperInvoke( |
399 Send node, Element element, NodeList arguments, Selector selector, _) { | 407 Send node, Element element, NodeList arguments, Selector selector, _) { |
400 // TODO(asgerf): Should really invoke 'super.noSuchMethod'. | 408 // TODO(asgerf): Should really invoke 'super.noSuchMethod'. |
401 return buildThrowNoSuchMethodError(kernel.getUnresolvedSuperMethodBuilder(), | 409 return buildThrowNoSuchMethodError(kernel.getUnresolvedSuperMethodBuilder(), |
402 new ir.ThisExpression(), '${node.selector}', buildArguments(arguments)); | 410 new ir.ThisExpression(), '${node.selector}', buildArguments(arguments)); |
403 } | 411 } |
404 | 412 |
405 ir.Expression visitUnresolvedSuperPostfix( | 413 ir.Expression visitUnresolvedSuperPostfix( |
406 Send node, Element element, IncDecOperator operator, _) { | 414 SendSet node, Element element, IncDecOperator operator, _) { |
407 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 415 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
408 } | 416 } |
409 | 417 |
410 ir.Expression visitUnresolvedSuperPrefix( | 418 ir.Expression visitUnresolvedSuperPrefix( |
411 Send node, Element element, IncDecOperator operator, _) { | 419 SendSet node, Element element, IncDecOperator operator, _) { |
412 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 420 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
413 } | 421 } |
414 | 422 |
415 ir.Expression visitUnresolvedSuperSetIfNull( | 423 ir.Expression visitUnresolvedSuperSetIfNull( |
416 Send node, Element element, Node rhs, _) { | 424 Send node, Element element, Node rhs, _) { |
417 return buildThrowUnresolvedSuperGetter('${node.selector}'); | 425 return buildThrowUnresolvedSuperGetter('${node.selector}'); |
418 } | 426 } |
419 | 427 |
420 ir.Expression visitUnresolvedSuperSetterCompound( | 428 ir.Expression visitUnresolvedSuperSetterCompound( |
421 Send node, | 429 Send node, |
422 MethodElement getter, | 430 GetterElement getter, |
423 Element element, | 431 Element element, |
424 AssignmentOperator operator, | 432 AssignmentOperator operator, |
425 Node rhs, | 433 Node rhs, |
426 _) { | 434 _) { |
427 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) | 435 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) |
428 .buildCompoundAssignment( | 436 .buildCompoundAssignment( |
429 new ir.Name(operator.selectorName), visitForValue(rhs)); | 437 new ir.Name(operator.selectorName), visitForValue(rhs)); |
430 } | 438 } |
431 | 439 |
432 ir.Expression visitUnresolvedSuperSetterCompoundIndexSet( | 440 ir.Expression visitUnresolvedSuperSetterCompoundIndexSet( |
433 Send node, | 441 SendSet node, |
434 MethodElement getter, | 442 MethodElement getter, |
435 Element element, | 443 Element element, |
436 Node index, | 444 Node index, |
437 AssignmentOperator operator, | 445 AssignmentOperator operator, |
438 Node rhs, | 446 Node rhs, |
439 _) { | 447 _) { |
440 return buildUnresolvedSuperIndexAccessor(index, element) | 448 return buildUnresolvedSuperIndexAccessor(index, element) |
441 .buildCompoundAssignment( | 449 .buildCompoundAssignment( |
442 new ir.Name(operator.selectorName), visitForValue(rhs)); | 450 new ir.Name(operator.selectorName), visitForValue(rhs)); |
443 } | 451 } |
444 | 452 |
445 ir.Expression visitUnresolvedSuperSetterIndexPostfix( | 453 ir.Expression visitUnresolvedSuperSetterIndexPostfix( |
446 Send node, | 454 SendSet node, |
447 MethodElement indexFunction, | 455 MethodElement indexFunction, |
448 Element element, | 456 Element element, |
449 Node index, | 457 Node index, |
450 IncDecOperator operator, | 458 IncDecOperator operator, |
451 _) { | 459 _) { |
452 return buildUnresolvedSuperIndexAccessor(index, element) | 460 return buildUnresolvedSuperIndexAccessor(index, element) |
453 .buildPostfixIncrement(new ir.Name(operator.selectorName)); | 461 .buildPostfixIncrement(new ir.Name(operator.selectorName)); |
454 } | 462 } |
455 | 463 |
456 ir.Expression visitUnresolvedSuperSetterIndexPrefix( | 464 ir.Expression visitUnresolvedSuperSetterIndexPrefix( |
457 Send node, | 465 SendSet node, |
458 MethodElement indexFunction, | 466 MethodElement indexFunction, |
459 Element element, | 467 Element element, |
460 Node index, | 468 Node index, |
461 IncDecOperator operator, | 469 IncDecOperator operator, |
462 _) { | 470 _) { |
463 return buildUnresolvedSuperIndexAccessor(index, element) | 471 return buildUnresolvedSuperIndexAccessor(index, element) |
464 .buildPrefixIncrement(new ir.Name(operator.selectorName)); | 472 .buildPrefixIncrement(new ir.Name(operator.selectorName)); |
465 } | 473 } |
466 | 474 |
467 ir.Expression visitUnresolvedSuperSetterPostfix(Send node, | 475 ir.Expression visitUnresolvedSuperSetterPostfix(SendSet node, |
468 MethodElement getter, Element element, IncDecOperator operator, _) { | 476 GetterElement getter, Element element, IncDecOperator operator, _) { |
469 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) | 477 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) |
470 .buildPostfixIncrement(new ir.Name(operator.selectorName)); | 478 .buildPostfixIncrement(new ir.Name(operator.selectorName)); |
471 } | 479 } |
472 | 480 |
473 ir.Expression visitUnresolvedSuperSetterPrefix(Send node, | 481 ir.Expression visitUnresolvedSuperSetterPrefix(SendSet node, |
474 MethodElement getter, Element element, IncDecOperator operator, _) { | 482 GetterElement getter, Element element, IncDecOperator operator, _) { |
475 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) | 483 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) |
476 .buildPrefixIncrement(new ir.Name(operator.selectorName)); | 484 .buildPrefixIncrement(new ir.Name(operator.selectorName)); |
477 } | 485 } |
478 | 486 |
479 ir.Expression visitUnresolvedSuperSetterSetIfNull( | 487 ir.Expression visitUnresolvedSuperSetterSetIfNull( |
480 Send node, MethodElement getter, Element element, Node rhs, _) { | 488 Send node, GetterElement getter, Element element, Node rhs, _) { |
481 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) | 489 return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter) |
482 .buildNullAwareAssignment(visitForValue(rhs), null); | 490 .buildNullAwareAssignment(visitForValue(rhs), null); |
483 } | 491 } |
484 | 492 |
485 ir.Expression visitUnresolvedSuperUnary( | 493 ir.Expression visitUnresolvedSuperUnary( |
486 Send node, UnaryOperator operator, Element element, _) { | 494 Send node, UnaryOperator operator, Element element, _) { |
487 // TODO(asgerf): Should really call 'super.noSuchMethod'. | 495 // TODO(asgerf): Should really call 'super.noSuchMethod'. |
488 return buildThrowNoSuchMethodError( | 496 return buildThrowNoSuchMethodError( |
489 kernel.getUnresolvedSuperMethodBuilder(), | 497 kernel.getUnresolvedSuperMethodBuilder(), |
490 new ir.ThisExpression(), | 498 new ir.ThisExpression(), |
(...skipping 25 matching lines...) Expand all Loading... |
516 } | 524 } |
517 | 525 |
518 ir.Expression visitUnresolvedTopLevelGetterSetIfNull( | 526 ir.Expression visitUnresolvedTopLevelGetterSetIfNull( |
519 Send node, Element element, MethodElement setter, Node rhs, _) { | 527 Send node, Element element, MethodElement setter, Node rhs, _) { |
520 return buildThrowUnresolvedGetter( | 528 return buildThrowUnresolvedGetter( |
521 '${node.selector}', kernel.getUnresolvedTopLevelGetterBuilder()); | 529 '${node.selector}', kernel.getUnresolvedTopLevelGetterBuilder()); |
522 } | 530 } |
523 | 531 |
524 ir.Expression visitUnresolvedTopLevelSetterCompound( | 532 ir.Expression visitUnresolvedTopLevelSetterCompound( |
525 Send node, | 533 Send node, |
526 MethodElement getter, | 534 GetterElement getter, |
527 Element element, | 535 Element element, |
528 AssignmentOperator operator, | 536 AssignmentOperator operator, |
529 Node rhs, | 537 Node rhs, |
530 _) { | 538 _) { |
531 var accessor = new TopLevelStaticAccessor( | 539 var accessor = new TopLevelStaticAccessor( |
532 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 540 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
533 var result = accessor.buildCompoundAssignment( | 541 var result = accessor.buildCompoundAssignment( |
534 new ir.Name(operator.selectorName), visitForValue(rhs), | 542 new ir.Name(operator.selectorName), visitForValue(rhs), |
535 voidContext: isVoidContext); | 543 voidContext: isVoidContext); |
536 associateCompoundComponents(accessor, node); | 544 associateCompoundComponents(accessor, node); |
537 return result; | 545 return result; |
538 } | 546 } |
539 | 547 |
540 ir.Expression visitUnresolvedTopLevelSetterPostfix(Send node, | 548 ir.Expression visitUnresolvedTopLevelSetterPostfix(Send node, |
541 MethodElement getter, Element element, IncDecOperator operator, _) { | 549 GetterElement getter, Element element, IncDecOperator operator, _) { |
542 var accessor = new TopLevelStaticAccessor( | 550 var accessor = new TopLevelStaticAccessor( |
543 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 551 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
544 var result = accessor.buildPostfixIncrement( | 552 var result = accessor.buildPostfixIncrement( |
545 new ir.Name(operator.selectorName), | 553 new ir.Name(operator.selectorName), |
546 voidContext: isVoidContext); | 554 voidContext: isVoidContext); |
547 associateCompoundComponents(accessor, node); | 555 associateCompoundComponents(accessor, node); |
548 return result; | 556 return result; |
549 } | 557 } |
550 | 558 |
551 ir.Expression visitUnresolvedTopLevelSetterPrefix(Send node, | 559 ir.Expression visitUnresolvedTopLevelSetterPrefix(Send node, |
552 MethodElement getter, Element element, IncDecOperator operator, _) { | 560 GetterElement getter, Element element, IncDecOperator operator, _) { |
553 var accessor = new TopLevelStaticAccessor( | 561 var accessor = new TopLevelStaticAccessor( |
554 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 562 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
555 var result = accessor.buildPrefixIncrement( | 563 var result = accessor.buildPrefixIncrement( |
556 new ir.Name(operator.selectorName), | 564 new ir.Name(operator.selectorName), |
557 voidContext: isVoidContext); | 565 voidContext: isVoidContext); |
558 associateCompoundComponents(accessor, node); | 566 associateCompoundComponents(accessor, node); |
559 return result; | 567 return result; |
560 } | 568 } |
561 | 569 |
562 ir.Expression visitUnresolvedTopLevelSetterSetIfNull( | 570 ir.Expression visitUnresolvedTopLevelSetterSetIfNull( |
563 Send node, MethodElement getter, Element element, Node rhs, _) { | 571 Send node, GetterElement getter, Element element, Node rhs, _) { |
564 var accessor = new TopLevelStaticAccessor( | 572 var accessor = new TopLevelStaticAccessor( |
565 this, getter.name, possiblyErroneousFunctionToIr(getter), null); | 573 this, getter.name, possiblyErroneousFunctionToIr(getter), null); |
566 return accessor.buildNullAwareAssignment(visitForValue(rhs), null, | 574 return accessor.buildNullAwareAssignment(visitForValue(rhs), null, |
567 voidContext: isVoidContext); | 575 voidContext: isVoidContext); |
568 } | 576 } |
569 | 577 |
570 ir.Expression visitUnresolvedSuperGetterIndexSetIfNull(Send node, | 578 ir.Expression visitUnresolvedSuperGetterIndexSetIfNull(SendSet node, |
571 Element element, MethodElement setter, Node index, Node rhs, _) { | 579 Element element, MethodElement setter, Node index, Node rhs, _) { |
572 return buildUnresolvedSuperIndexAccessor(index, element) | 580 return buildUnresolvedSuperIndexAccessor(index, element) |
573 .buildNullAwareAssignment(visitForValue(rhs), null); | 581 .buildNullAwareAssignment(visitForValue(rhs), null); |
574 } | 582 } |
575 | 583 |
576 ir.Expression visitUnresolvedSuperSetterIndexSetIfNull(Send node, | 584 ir.Expression visitUnresolvedSuperSetterIndexSetIfNull(SendSet node, |
577 MethodElement getter, Element element, Node index, Node rhs, _) { | 585 MethodElement getter, Element element, Node index, Node rhs, _) { |
578 return buildUnresolvedSuperIndexAccessor(index, element) | 586 return buildUnresolvedSuperIndexAccessor(index, element) |
579 .buildNullAwareAssignment(visitForValue(rhs), null); | 587 .buildNullAwareAssignment(visitForValue(rhs), null); |
580 } | 588 } |
581 | 589 |
582 ir.Expression visitUnresolvedSuperIndexSetIfNull( | 590 ir.Expression visitUnresolvedSuperIndexSetIfNull( |
583 Send node, Element element, Node index, Node rhs, _) { | 591 Send node, Element element, Node index, Node rhs, _) { |
584 return buildUnresolvedSuperIndexAccessor(index, element) | 592 return buildUnresolvedSuperIndexAccessor(index, element) |
585 .buildNullAwareAssignment(visitForValue(rhs), null); | 593 .buildNullAwareAssignment(visitForValue(rhs), null); |
586 } | 594 } |
587 | 595 |
588 ir.Expression visitUnresolvedSuperSet( | 596 ir.Expression visitUnresolvedSuperSet( |
589 Send node, Element element, Node rhs, _) { | 597 Send node, Element element, Node rhs, _) { |
590 return buildThrowUnresolvedSuperSetter( | 598 return buildThrowUnresolvedSuperSetter( |
591 '${node.selector}', visitForValue(rhs)); | 599 '${node.selector}', visitForValue(rhs)); |
592 } | 600 } |
593 } | 601 } |
OLD | NEW |