| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
| 8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 LocalFunctionElement function, | 770 LocalFunctionElement function, |
| 771 _) { | 771 _) { |
| 772 return irBuilder.buildLocalFunctionGet(function); | 772 return irBuilder.buildLocalFunctionGet(function); |
| 773 } | 773 } |
| 774 | 774 |
| 775 @override | 775 @override |
| 776 ir.Primitive handleStaticFunctionGet( | 776 ir.Primitive handleStaticFunctionGet( |
| 777 ast.Send node, | 777 ast.Send node, |
| 778 MethodElement function, | 778 MethodElement function, |
| 779 _) { | 779 _) { |
| 780 // TODO(karlklose): support foreign functions. | |
| 781 if (compiler.backend.isForeign(function)) { | |
| 782 return giveup(node, 'handleStaticFunctionGet: foreign: $function'); | |
| 783 } | |
| 784 return irBuilder.buildStaticFunctionGet(function); | 780 return irBuilder.buildStaticFunctionGet(function); |
| 785 } | 781 } |
| 786 | 782 |
| 787 @override | 783 @override |
| 788 ir.Primitive handleStaticGetterGet( | 784 ir.Primitive handleStaticGetterGet( |
| 789 ast.Send node, | 785 ast.Send node, |
| 790 FunctionElement getter, | 786 FunctionElement getter, |
| 791 _) { | 787 _) { |
| 792 return irBuilder.buildStaticGetterGet( | 788 return irBuilder.buildStaticGetterGet( |
| 793 getter, sourceInformationBuilder.buildGet(node)); | 789 getter, sourceInformationBuilder.buildGet(node)); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 arguments.nodes.mapToList(visit)); | 1172 arguments.nodes.mapToList(visit)); |
| 1177 } | 1173 } |
| 1178 | 1174 |
| 1179 @override | 1175 @override |
| 1180 ir.Primitive handleStaticGetterInvoke( | 1176 ir.Primitive handleStaticGetterInvoke( |
| 1181 ast.Send node, | 1177 ast.Send node, |
| 1182 FunctionElement getter, | 1178 FunctionElement getter, |
| 1183 ast.NodeList arguments, | 1179 ast.NodeList arguments, |
| 1184 CallStructure callStructure, | 1180 CallStructure callStructure, |
| 1185 _) { | 1181 _) { |
| 1186 if (compiler.backend.isForeign(getter)) { | |
| 1187 return giveup(node, 'handleStaticGetterInvoke: foreign: $getter'); | |
| 1188 } | |
| 1189 ir.Primitive target = irBuilder.buildStaticGetterGet( | 1182 ir.Primitive target = irBuilder.buildStaticGetterGet( |
| 1190 getter, sourceInformationBuilder.buildGet(node)); | 1183 getter, sourceInformationBuilder.buildGet(node)); |
| 1191 return irBuilder.buildCallInvocation(target, | 1184 return irBuilder.buildCallInvocation(target, |
| 1192 callStructure, | 1185 callStructure, |
| 1193 translateDynamicArguments(arguments, callStructure), | 1186 translateDynamicArguments(arguments, callStructure), |
| 1194 sourceInformation: | 1187 sourceInformation: |
| 1195 sourceInformationBuilder.buildCall(node, arguments)); | 1188 sourceInformationBuilder.buildCall(node, arguments)); |
| 1196 } | 1189 } |
| 1197 | 1190 |
| 1198 @override | 1191 @override |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 return action(); | 2247 return action(); |
| 2255 } catch(e) { | 2248 } catch(e) { |
| 2256 if (e == ABORT_IRNODE_BUILDER) { | 2249 if (e == ABORT_IRNODE_BUILDER) { |
| 2257 return null; | 2250 return null; |
| 2258 } | 2251 } |
| 2259 rethrow; | 2252 rethrow; |
| 2260 } | 2253 } |
| 2261 } | 2254 } |
| 2262 | 2255 |
| 2263 internalError(ast.Node node, String message) { | 2256 internalError(ast.Node node, String message) { |
| 2264 giveup(node, message); | 2257 compiler.internalError(node, message); |
| 2265 } | 2258 } |
| 2266 | 2259 |
| 2267 @override | 2260 @override |
| 2268 visitNode(ast.Node node) { | 2261 visitNode(ast.Node node) { |
| 2269 internalError(node, "Unhandled node"); | 2262 giveup(node, "Unhandled node"); |
| 2270 } | 2263 } |
| 2271 | 2264 |
| 2272 dynamic giveup(ast.Node node, [String reason]) { | 2265 dynamic giveup(ast.Node node, [String reason]) { |
| 2273 bailoutMessage = '($node): $reason'; | 2266 bailoutMessage = '($node): $reason'; |
| 2274 throw ABORT_IRNODE_BUILDER; | 2267 throw ABORT_IRNODE_BUILDER; |
| 2275 } | 2268 } |
| 2276 } | 2269 } |
| 2277 | 2270 |
| 2278 final String ABORT_IRNODE_BUILDER = "IrNode builder aborted"; | 2271 final String ABORT_IRNODE_BUILDER = "IrNode builder aborted"; |
| 2279 | 2272 |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3577 if (compiler.backend.isForeign(function)) { | 3570 if (compiler.backend.isForeign(function)) { |
| 3578 return handleForeignCode(node, function, argumentList, callStructure); | 3571 return handleForeignCode(node, function, argumentList, callStructure); |
| 3579 } else { | 3572 } else { |
| 3580 return irBuilder.buildStaticFunctionInvocation(function, callStructure, | 3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure, |
| 3581 translateStaticArguments(argumentList, function, callStructure), | 3574 translateStaticArguments(argumentList, function, callStructure), |
| 3582 sourceInformation: | 3575 sourceInformation: |
| 3583 sourceInformationBuilder.buildCall(node, node.selector)); | 3576 sourceInformationBuilder.buildCall(node, node.selector)); |
| 3584 } | 3577 } |
| 3585 } | 3578 } |
| 3586 } | 3579 } |
| OLD | NEW |