| 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 import 'package:kernel/frontend/accessors.dart' | 6 import 'package:kernel/frontend/accessors.dart' |
| 7 show | 7 show |
| 8 Accessor, | 8 Accessor, |
| 9 IndexAccessor, | 9 IndexAccessor, |
| 10 NullAwarePropertyAccessor, | 10 NullAwarePropertyAccessor, |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 Accessor buildNullAwarePropertyAccessor(Node receiver, Name name) { | 1508 Accessor buildNullAwarePropertyAccessor(Node receiver, Name name) { |
| 1509 return new NullAwarePropertyAccessor( | 1509 return new NullAwarePropertyAccessor( |
| 1510 visitForValue(receiver), nameToIrName(name), null, null, null); | 1510 visitForValue(receiver), nameToIrName(name), null, null, null); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 @override | 1513 @override |
| 1514 ir.Expression visitIfNotNullDynamicPropertyGet( | 1514 ir.Expression visitIfNotNullDynamicPropertyGet( |
| 1515 Send node, Node receiver, Name name, _) { | 1515 Send node, Node receiver, Name name, _) { |
| 1516 return buildNullAwarePropertyAccessor(receiver, name).buildSimpleRead(); | 1516 Accessor accessor = buildNullAwarePropertyAccessor(receiver, name); |
| 1517 ir.Expression result = accessor.buildSimpleRead(); |
| 1518 if (accessor.builtGetter != null) { |
| 1519 kernel.nodeToAst[accessor.builtGetter] = node; |
| 1520 } |
| 1521 return result; |
| 1517 } | 1522 } |
| 1518 | 1523 |
| 1519 @override | 1524 @override |
| 1520 ir.Let visitIfNotNullDynamicPropertyInvoke( | 1525 ir.Let visitIfNotNullDynamicPropertyInvoke( |
| 1521 Send node, Node receiverNode, NodeList arguments, Selector selector, _) { | 1526 Send node, Node receiverNode, NodeList arguments, Selector selector, _) { |
| 1522 ir.VariableDeclaration receiver = | 1527 ir.VariableDeclaration receiver = |
| 1523 makeOrReuseVariable(visitForValue(receiverNode)); | 1528 makeOrReuseVariable(visitForValue(receiverNode)); |
| 1524 return makeLet( | 1529 return makeLet( |
| 1525 receiver, | 1530 receiver, |
| 1526 new ir.ConditionalExpression( | 1531 new ir.ConditionalExpression( |
| 1527 buildIsNull(new ir.VariableGet(receiver)), | 1532 buildIsNull(new ir.VariableGet(receiver)), |
| 1528 new ir.NullLiteral(), | 1533 new ir.NullLiteral(), |
| 1529 buildInvokeSelector(new ir.VariableGet(receiver), selector, | 1534 associateNode( |
| 1530 buildArguments(arguments)), | 1535 buildInvokeSelector(new ir.VariableGet(receiver), selector, |
| 1536 buildArguments(arguments)), |
| 1537 receiverNode), |
| 1531 null)); | 1538 null)); |
| 1532 } | 1539 } |
| 1533 | 1540 |
| 1534 @override | 1541 @override |
| 1535 ir.Expression visitIfNotNullDynamicPropertySet( | 1542 ir.Expression visitIfNotNullDynamicPropertySet( |
| 1536 SendSet node, Node receiver, Name name, Node rhs, _) { | 1543 SendSet node, Node receiver, Name name, Node rhs, _) { |
| 1537 return buildNullAwarePropertyAccessor(receiver, name) | 1544 return buildNullAwarePropertyAccessor(receiver, name) |
| 1538 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 1545 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
| 1539 } | 1546 } |
| 1540 | 1547 |
| (...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 : this(null, true, node, initializers); | 2847 : this(null, true, node, initializers); |
| 2841 | 2848 |
| 2842 accept(ir.Visitor v) => throw "unsupported"; | 2849 accept(ir.Visitor v) => throw "unsupported"; |
| 2843 | 2850 |
| 2844 visitChildren(ir.Visitor v) => throw "unsupported"; | 2851 visitChildren(ir.Visitor v) => throw "unsupported"; |
| 2845 | 2852 |
| 2846 String toString() { | 2853 String toString() { |
| 2847 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2854 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
| 2848 } | 2855 } |
| 2849 } | 2856 } |
| OLD | NEW |