| 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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 return buildIrFunction( | 2155 return buildIrFunction( |
| 2156 computeInstanceMethodKind(currentElement), currentElement, null); | 2156 computeInstanceMethodKind(currentElement), currentElement, null); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 @override | 2159 @override |
| 2160 ir.Expression handleStaticFunctionGet(Send node, MethodElement function, _) { | 2160 ir.Expression handleStaticFunctionGet(Send node, MethodElement function, _) { |
| 2161 return buildStaticGet(function); | 2161 return buildStaticGet(function); |
| 2162 } | 2162 } |
| 2163 | 2163 |
| 2164 @override | 2164 @override |
| 2165 ir.StaticInvocation handleStaticFunctionIncompatibleInvoke( | 2165 ir.Expression handleStaticFunctionIncompatibleInvoke( |
| 2166 Send node, | 2166 Send node, |
| 2167 MethodElement function, | 2167 MethodElement function, |
| 2168 NodeList arguments, | 2168 NodeList arguments, |
| 2169 CallStructure callStructure, | 2169 CallStructure callStructure, |
| 2170 _) { | 2170 _) { |
| 2171 if (!kernel.compiler.resolution.hasBeenResolved(function) && |
| 2172 !function.isMalformed) { |
| 2173 // TODO(sigmund): consider calling nSM or handle recovery differently |
| 2174 // here. This case occurs only when this call was the only call to |
| 2175 // function, and knowing that the call was erroneous, our resolver didn't |
| 2176 // enqueue function itself. |
| 2177 return new ir.InvalidExpression(); |
| 2178 } |
| 2171 return buildStaticInvoke(function, arguments, isConst: false); | 2179 return buildStaticInvoke(function, arguments, isConst: false); |
| 2172 } | 2180 } |
| 2173 | 2181 |
| 2174 ir.StaticInvocation buildStaticInvoke( | 2182 ir.StaticInvocation buildStaticInvoke( |
| 2175 FunctionElement function, NodeList arguments, | 2183 FunctionElement function, NodeList arguments, |
| 2176 {bool isConst}) { | 2184 {bool isConst}) { |
| 2177 ir.Arguments argumentsNode = buildArguments(arguments); | 2185 ir.Arguments argumentsNode = buildArguments(arguments); |
| 2178 return new ir.StaticInvocation(kernel.functionToIr(function), argumentsNode, | 2186 return new ir.StaticInvocation(kernel.functionToIr(function), argumentsNode, |
| 2179 isConst: isConst); | 2187 isConst: isConst); |
| 2180 } | 2188 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 MethodElement setter, NodeList parameters, Node body, _) { | 2242 MethodElement setter, NodeList parameters, Node body, _) { |
| 2235 return buildIrFunction(ir.ProcedureKind.Setter, setter, body); | 2243 return buildIrFunction(ir.ProcedureKind.Setter, setter, body); |
| 2236 } | 2244 } |
| 2237 | 2245 |
| 2238 @override | 2246 @override |
| 2239 ir.Expression handleStaticSetterGet(Send node, FunctionElement setter, _) { | 2247 ir.Expression handleStaticSetterGet(Send node, FunctionElement setter, _) { |
| 2240 return buildStaticAccessor(null, setter).buildSimpleRead(); | 2248 return buildStaticAccessor(null, setter).buildSimpleRead(); |
| 2241 } | 2249 } |
| 2242 | 2250 |
| 2243 @override | 2251 @override |
| 2244 ir.MethodInvocation handleStaticSetterInvoke( | 2252 ir.Expression handleStaticSetterInvoke( |
| 2245 Send node, | 2253 Send node, |
| 2246 FunctionElement setter, | 2254 FunctionElement setter, |
| 2247 NodeList arguments, | 2255 NodeList arguments, |
| 2248 CallStructure callStructure, | 2256 CallStructure callStructure, |
| 2249 _) { | 2257 _) { |
| 2250 return buildCall(buildStaticAccessor(null, setter).buildSimpleRead(), | 2258 return new ir.InvalidExpression(); |
| 2251 callStructure, arguments); | |
| 2252 } | 2259 } |
| 2253 | 2260 |
| 2254 @override | 2261 @override |
| 2255 ir.Expression handleStaticSetterSet( | 2262 ir.Expression handleStaticSetterSet( |
| 2256 SendSet node, FunctionElement setter, Node rhs, _) { | 2263 SendSet node, FunctionElement setter, Node rhs, _) { |
| 2257 return buildStaticAccessor(null, setter) | 2264 return buildStaticAccessor(null, setter) |
| 2258 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); | 2265 .buildAssignment(visitForValue(rhs), voidContext: isVoidContext); |
| 2259 } | 2266 } |
| 2260 | 2267 |
| 2261 @override | 2268 @override |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 : this(null, true, node, initializers); | 2854 : this(null, true, node, initializers); |
| 2848 | 2855 |
| 2849 accept(ir.Visitor v) => throw "unsupported"; | 2856 accept(ir.Visitor v) => throw "unsupported"; |
| 2850 | 2857 |
| 2851 visitChildren(ir.Visitor v) => throw "unsupported"; | 2858 visitChildren(ir.Visitor v) => throw "unsupported"; |
| 2852 | 2859 |
| 2853 String toString() { | 2860 String toString() { |
| 2854 return "IrFunction($kind, $isConstructor, $node, $initializers)"; | 2861 return "IrFunction($kind, $isConstructor, $node, $initializers)"; |
| 2855 } | 2862 } |
| 2856 } | 2863 } |
| OLD | NEW |