| 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 return buildTypeLiteral(constant); | 1198 return buildTypeLiteral(constant); |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 @override | 1201 @override |
| 1202 ir.MethodInvocation visitClassTypeLiteralInvoke( | 1202 ir.MethodInvocation visitClassTypeLiteralInvoke( |
| 1203 Send node, | 1203 Send node, |
| 1204 ConstantExpression constant, | 1204 ConstantExpression constant, |
| 1205 NodeList arguments, | 1205 NodeList arguments, |
| 1206 CallStructure callStructure, | 1206 CallStructure callStructure, |
| 1207 _) { | 1207 _) { |
| 1208 return buildCall(buildTypeLiteral(constant), callStructure, arguments); | 1208 return associateNode( |
| 1209 buildCall(buildTypeLiteral(constant), callStructure, arguments), node); |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 ir.Expression buildTypeLiteralSet(TypeConstantExpression constant, Node rhs) { | 1212 ir.Expression buildTypeLiteralSet(TypeConstantExpression constant, Node rhs) { |
| 1212 return new ReadOnlyAccessor(buildTypeLiteral(constant)) | 1213 return new ReadOnlyAccessor(buildTypeLiteral(constant)) |
| 1213 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 1214 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
| 1214 } | 1215 } |
| 1215 | 1216 |
| 1216 @override | 1217 @override |
| 1217 ir.Expression visitClassTypeLiteralSet( | 1218 ir.Expression visitClassTypeLiteralSet( |
| 1218 SendSet node, ConstantExpression constant, Node rhs, _) { | 1219 SendSet node, ConstantExpression constant, Node rhs, _) { |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 return buildStaticGet(getter); | 2228 return buildStaticGet(getter); |
| 2228 } | 2229 } |
| 2229 | 2230 |
| 2230 @override | 2231 @override |
| 2231 ir.Expression handleStaticGetterInvoke(Send node, FunctionElement getter, | 2232 ir.Expression handleStaticGetterInvoke(Send node, FunctionElement getter, |
| 2232 NodeList arguments, CallStructure callStructure, _) { | 2233 NodeList arguments, CallStructure callStructure, _) { |
| 2233 if (getter.isDeferredLoaderGetter) { | 2234 if (getter.isDeferredLoaderGetter) { |
| 2234 // TODO(ahe): Support deferred load. | 2235 // TODO(ahe): Support deferred load. |
| 2235 return new ir.InvalidExpression(); | 2236 return new ir.InvalidExpression(); |
| 2236 } | 2237 } |
| 2237 return buildCall(buildStaticGet(getter), callStructure, arguments); | 2238 return associateNode( |
| 2239 buildCall(buildStaticGet(getter), callStructure, arguments), node); |
| 2238 } | 2240 } |
| 2239 | 2241 |
| 2240 @override | 2242 @override |
| 2241 ir.Expression handleStaticGetterSet( | 2243 ir.Expression handleStaticGetterSet( |
| 2242 SendSet node, FunctionElement getter, Node rhs, _) { | 2244 SendSet node, FunctionElement getter, Node rhs, _) { |
| 2243 return buildStaticAccessor(getter) | 2245 return buildStaticAccessor(getter) |
| 2244 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 2246 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
| 2245 } | 2247 } |
| 2246 | 2248 |
| 2247 @override | 2249 @override |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2581 } | 2583 } |
| 2582 | 2584 |
| 2583 @override | 2585 @override |
| 2584 ir.ThisExpression visitThisGet(Identifier node, _) { | 2586 ir.ThisExpression visitThisGet(Identifier node, _) { |
| 2585 return new ir.ThisExpression(); | 2587 return new ir.ThisExpression(); |
| 2586 } | 2588 } |
| 2587 | 2589 |
| 2588 @override | 2590 @override |
| 2589 ir.MethodInvocation visitThisInvoke( | 2591 ir.MethodInvocation visitThisInvoke( |
| 2590 Send node, NodeList arguments, CallStructure callStructure, _) { | 2592 Send node, NodeList arguments, CallStructure callStructure, _) { |
| 2591 return buildCall(new ir.ThisExpression(), callStructure, arguments); | 2593 return associateNode( |
| 2594 buildCall(new ir.ThisExpression(), callStructure, arguments), node); |
| 2592 } | 2595 } |
| 2593 | 2596 |
| 2594 Accessor buildThisPropertyAccessor(Name name) { | 2597 Accessor buildThisPropertyAccessor(Name name) { |
| 2595 return new ThisPropertyAccessor(nameToIrName(name), null, null); | 2598 return new ThisPropertyAccessor(nameToIrName(name), null, null); |
| 2596 } | 2599 } |
| 2597 | 2600 |
| 2598 @override | 2601 @override |
| 2599 ir.Expression visitThisPropertyGet(Send node, Name name, _) { | 2602 ir.Expression visitThisPropertyGet(Send node, Name name, _) { |
| 2600 return associateNode( | 2603 return associateNode( |
| 2601 buildThisPropertyAccessor(name).buildSimpleRead(), node); | 2604 buildThisPropertyAccessor(name).buildSimpleRead(), node); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 return buildTypeVariable(element); | 2671 return buildTypeVariable(element); |
| 2669 } | 2672 } |
| 2670 | 2673 |
| 2671 @override | 2674 @override |
| 2672 ir.MethodInvocation visitTypeVariableTypeLiteralInvoke( | 2675 ir.MethodInvocation visitTypeVariableTypeLiteralInvoke( |
| 2673 Send node, | 2676 Send node, |
| 2674 TypeVariableElement element, | 2677 TypeVariableElement element, |
| 2675 NodeList arguments, | 2678 NodeList arguments, |
| 2676 CallStructure callStructure, | 2679 CallStructure callStructure, |
| 2677 _) { | 2680 _) { |
| 2678 return buildCall(buildTypeVariable(element), callStructure, arguments); | 2681 return associateNode( |
| 2682 buildCall(buildTypeVariable(element), callStructure, arguments), node); |
| 2679 } | 2683 } |
| 2680 | 2684 |
| 2681 @override | 2685 @override |
| 2682 ir.Expression visitTypeVariableTypeLiteralSet( | 2686 ir.Expression visitTypeVariableTypeLiteralSet( |
| 2683 SendSet node, TypeVariableElement element, Node rhs, _) { | 2687 SendSet node, TypeVariableElement element, Node rhs, _) { |
| 2684 return new ReadOnlyAccessor(buildTypeVariable(element)) | 2688 return new ReadOnlyAccessor(buildTypeVariable(element)) |
| 2685 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 2689 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
| 2686 } | 2690 } |
| 2687 | 2691 |
| 2688 @override | 2692 @override |
| 2689 ir.Expression visitTypeVariableTypeLiteralSetIfNull( | 2693 ir.Expression visitTypeVariableTypeLiteralSetIfNull( |
| 2690 Send node, TypeVariableElement element, Node rhs, _) { | 2694 Send node, TypeVariableElement element, Node rhs, _) { |
| 2691 return _finishSetIfNull( | 2695 return _finishSetIfNull( |
| 2692 node, new ReadOnlyAccessor(buildTypeVariable(element)), rhs); | 2696 node, new ReadOnlyAccessor(buildTypeVariable(element)), rhs); |
| 2693 } | 2697 } |
| 2694 | 2698 |
| 2695 @override | 2699 @override |
| 2696 ir.TypeLiteral visitTypedefTypeLiteralGet( | 2700 ir.TypeLiteral visitTypedefTypeLiteralGet( |
| 2697 Send node, ConstantExpression constant, _) { | 2701 Send node, ConstantExpression constant, _) { |
| 2698 return buildTypeLiteral(constant); | 2702 return buildTypeLiteral(constant); |
| 2699 } | 2703 } |
| 2700 | 2704 |
| 2701 @override | 2705 @override |
| 2702 ir.MethodInvocation visitTypedefTypeLiteralInvoke( | 2706 ir.MethodInvocation visitTypedefTypeLiteralInvoke( |
| 2703 Send node, | 2707 Send node, |
| 2704 ConstantExpression constant, | 2708 ConstantExpression constant, |
| 2705 NodeList arguments, | 2709 NodeList arguments, |
| 2706 CallStructure callStructure, | 2710 CallStructure callStructure, |
| 2707 _) { | 2711 _) { |
| 2708 return buildCall(buildTypeLiteral(constant), callStructure, arguments); | 2712 return associateNode( |
| 2713 buildCall(buildTypeLiteral(constant), callStructure, arguments), node); |
| 2709 } | 2714 } |
| 2710 | 2715 |
| 2711 @override | 2716 @override |
| 2712 ir.Expression visitTypedefTypeLiteralSet( | 2717 ir.Expression visitTypedefTypeLiteralSet( |
| 2713 SendSet node, ConstantExpression constant, Node rhs, _) { | 2718 SendSet node, ConstantExpression constant, Node rhs, _) { |
| 2714 return buildTypeLiteralSet(constant, rhs); | 2719 return buildTypeLiteralSet(constant, rhs); |
| 2715 } | 2720 } |
| 2716 | 2721 |
| 2717 @override | 2722 @override |
| 2718 ir.Expression handleTypeLiteralConstantSetIfNulls( | 2723 ir.Expression handleTypeLiteralConstantSetIfNulls( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 : this(null, true, node, initializers); | 2857 : this(null, true, node, initializers); |
| 2853 | 2858 |
| 2854 accept(ir.Visitor v) => throw "unsupported"; | 2859 accept(ir.Visitor v) => throw "unsupported"; |
| 2855 | 2860 |
| 2856 visitChildren(ir.Visitor v) => throw "unsupported"; | 2861 visitChildren(ir.Visitor v) => throw "unsupported"; |
| 2857 | 2862 |
| 2858 String toString() { | 2863 String toString() { |
| 2859 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2864 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
| 2860 } | 2865 } |
| 2861 } | 2866 } |
| OLD | NEW |