| 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.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show | 10 import '../common/names.dart' show |
| (...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3558 case 'JS_INTERCEPTOR_CONSTANT': | 3558 case 'JS_INTERCEPTOR_CONSTANT': |
| 3559 validateArgumentCount(exactly: 1); | 3559 validateArgumentCount(exactly: 1); |
| 3560 | 3560 |
| 3561 ast.Node argument = argumentNodes.head; | 3561 ast.Node argument = argumentNodes.head; |
| 3562 ir.Primitive argumentValue = visit(argument); | 3562 ir.Primitive argumentValue = visit(argument); |
| 3563 if (argumentValue is ir.Constant && argumentValue.value.isType) { | 3563 if (argumentValue is ir.Constant && argumentValue.value.isType) { |
| 3564 TypeConstantValue constant = argumentValue.value; | 3564 TypeConstantValue constant = argumentValue.value; |
| 3565 ConstantValue interceptorValue = | 3565 ConstantValue interceptorValue = |
| 3566 new InterceptorConstantValue(constant.representedType); | 3566 new InterceptorConstantValue(constant.representedType); |
| 3567 return irBuilder.buildConstant(interceptorValue); | 3567 return irBuilder.buildConstant(interceptorValue); |
| 3568 } else { | |
| 3569 internalError(argument, 'expected Type as argument'); | |
| 3570 } | 3568 } |
| 3571 break; | 3569 return internalError(argument, 'expected Type as argument'); |
| 3572 | 3570 |
| 3573 case 'JS_EFFECT': | 3571 case 'JS_EFFECT': |
| 3574 return irBuilder.buildNullConstant(); | 3572 return irBuilder.buildNullConstant(); |
| 3575 | 3573 |
| 3576 case 'JS_GET_NAME': | 3574 case 'JS_GET_NAME': |
| 3577 validateArgumentCount(exactly: 1); | 3575 validateArgumentCount(exactly: 1); |
| 3578 | 3576 |
| 3579 ast.Node argument = argumentNodes.head; | 3577 ast.Node argument = argumentNodes.head; |
| 3580 JsGetName id = getEnumValue(argument, helpers.jsGetNameEnum, | 3578 JsGetName id = getEnumValue(argument, helpers.jsGetNameEnum, |
| 3581 JsGetName.values); | 3579 JsGetName.values); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 | 3640 |
| 3643 if (!compiler.hasIsolateSupport) { | 3641 if (!compiler.hasIsolateSupport) { |
| 3644 ir.Primitive closure = visit(argumentNodes.tail.head); | 3642 ir.Primitive closure = visit(argumentNodes.tail.head); |
| 3645 return irBuilder.buildCallInvocation(closure, CallStructure.NO_ARGS, | 3643 return irBuilder.buildCallInvocation(closure, CallStructure.NO_ARGS, |
| 3646 const <ir.Primitive>[]); | 3644 const <ir.Primitive>[]); |
| 3647 } | 3645 } |
| 3648 return buildIsolateHelperInvocation(backend.helpers.callInIsolate, | 3646 return buildIsolateHelperInvocation(backend.helpers.callInIsolate, |
| 3649 CallStructure.TWO_ARGS); | 3647 CallStructure.TWO_ARGS); |
| 3650 | 3648 |
| 3651 default: | 3649 default: |
| 3652 giveup(node, 'unplemented native construct: ${function.name}'); | 3650 return giveup(node, 'unplemented native construct: ${function.name}'); |
| 3653 break; | |
| 3654 } | 3651 } |
| 3655 } | 3652 } |
| 3656 | 3653 |
| 3657 @override | 3654 @override |
| 3658 ir.Primitive handleStaticFunctionInvoke(ast.Send node, | 3655 ir.Primitive handleStaticFunctionInvoke(ast.Send node, |
| 3659 MethodElement function, | 3656 MethodElement function, |
| 3660 ast.NodeList argumentsNode, | 3657 ast.NodeList argumentsNode, |
| 3661 CallStructure callStructure, | 3658 CallStructure callStructure, |
| 3662 _) { | 3659 _) { |
| 3663 if (compiler.backend.isForeign(function)) { | 3660 if (compiler.backend.isForeign(function)) { |
| 3664 return handleForeignCode(node, function, argumentsNode, callStructure); | 3661 return handleForeignCode(node, function, argumentsNode, callStructure); |
| 3665 } else { | 3662 } else { |
| 3666 List<ir.Primitive> arguments = <ir.Primitive>[]; | 3663 List<ir.Primitive> arguments = <ir.Primitive>[]; |
| 3667 callStructure = translateStaticArguments(argumentsNode, function, | 3664 callStructure = translateStaticArguments(argumentsNode, function, |
| 3668 callStructure, arguments); | 3665 callStructure, arguments); |
| 3669 return irBuilder.buildStaticFunctionInvocation(function, | 3666 return irBuilder.buildStaticFunctionInvocation(function, |
| 3670 callStructure, | 3667 callStructure, |
| 3671 arguments, | 3668 arguments, |
| 3672 sourceInformation: | 3669 sourceInformation: |
| 3673 sourceInformationBuilder.buildCall(node, node.selector)); | 3670 sourceInformationBuilder.buildCall(node, node.selector)); |
| 3674 } | 3671 } |
| 3675 } | 3672 } |
| 3676 } | 3673 } |
| OLD | NEW |