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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 | 1138 |
1139 @override | 1139 @override |
1140 ir.MethodInvocation visitBinary( | 1140 ir.MethodInvocation visitBinary( |
1141 Send node, Node left, BinaryOperator operator, Node right, _) { | 1141 Send node, Node left, BinaryOperator operator, Node right, _) { |
1142 return associateNode( | 1142 return associateNode( |
1143 buildBinaryOperator(left, operator.selectorName, right), node); | 1143 buildBinaryOperator(left, operator.selectorName, right), node); |
1144 } | 1144 } |
1145 | 1145 |
1146 ir.Expression buildConstructorInvoke(NewExpression node, {bool isConst}) { | 1146 ir.Expression buildConstructorInvoke(NewExpression node, {bool isConst}) { |
1147 ConstructorElement constructor = elements[node.send]; | 1147 ConstructorElement constructor = elements[node.send]; |
1148 ConstructorTarget target = | 1148 ConstructorTarget target; |
1149 kernel.computeEffectiveTarget(constructor, elements.getType(node)); | 1149 if (isConst) { |
| 1150 target = |
| 1151 kernel.computeEffectiveTarget(constructor, elements.getType(node)); |
| 1152 } else { |
| 1153 target = new ConstructorTarget(constructor, elements.getType(node)); |
| 1154 } |
1150 NodeList arguments = node.send.argumentsNode; | 1155 NodeList arguments = node.send.argumentsNode; |
1151 if (kernel.isSyntheticError(target.element)) { | 1156 if (kernel.isSyntheticError(target.element)) { |
1152 return new ir.MethodInvocation(new ir.InvalidExpression(), | 1157 return new ir.MethodInvocation(new ir.InvalidExpression(), |
1153 kernel.irName("call", currentElement), buildArguments(arguments)); | 1158 kernel.irName("call", currentElement), buildArguments(arguments)); |
1154 } | 1159 } |
1155 ir.InvocationExpression invoke = target.element.isGenerativeConstructor | 1160 ir.InvocationExpression invoke = target.element.isGenerativeConstructor |
1156 ? buildGenerativeConstructorInvoke(target.element, arguments, | 1161 ? buildGenerativeConstructorInvoke(target.element, arguments, |
1157 isConst: isConst) | 1162 isConst: isConst) |
1158 : buildStaticInvoke(target.element, arguments, isConst: isConst); | 1163 : buildStaticInvoke(target.element, arguments, isConst: isConst); |
1159 if (target.type.isInterfaceType) { | 1164 if (target.type.isInterfaceType) { |
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2759 : this(null, true, node, initializers); | 2764 : this(null, true, node, initializers); |
2760 | 2765 |
2761 accept(ir.Visitor v) => throw "unsupported"; | 2766 accept(ir.Visitor v) => throw "unsupported"; |
2762 | 2767 |
2763 visitChildren(ir.Visitor v) => throw "unsupported"; | 2768 visitChildren(ir.Visitor v) => throw "unsupported"; |
2764 | 2769 |
2765 String toString() { | 2770 String toString() { |
2766 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2771 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
2767 } | 2772 } |
2768 } | 2773 } |
OLD | NEW |