| 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; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import '../closure.dart' hide ClosureScope; | 7 import '../closure.dart' hide ClosureScope; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 behavior); | 2066 behavior); |
| 2067 } | 2067 } |
| 2068 | 2068 |
| 2069 /// Generate the body for a native function that redirects to a native | 2069 /// Generate the body for a native function that redirects to a native |
| 2070 /// JavaScript function, getter, or setter. | 2070 /// JavaScript function, getter, or setter. |
| 2071 /// | 2071 /// |
| 2072 /// Generates a call to the real target, which is given by [functions]'s | 2072 /// Generates a call to the real target, which is given by [functions]'s |
| 2073 /// `fixedBackendName`, passing all parameters as arguments. The target can | 2073 /// `fixedBackendName`, passing all parameters as arguments. The target can |
| 2074 /// be the JavaScript implementation of a function, getter, or setter. | 2074 /// be the JavaScript implementation of a function, getter, or setter. |
| 2075 void buildRedirectingNativeFunctionBody(FunctionElement function, | 2075 void buildRedirectingNativeFunctionBody(FunctionElement function, |
| 2076 String name, |
| 2076 SourceInformation source) { | 2077 SourceInformation source) { |
| 2077 String name = function.fixedBackendName; | |
| 2078 List<ir.Primitive> arguments = <ir.Primitive>[]; | 2078 List<ir.Primitive> arguments = <ir.Primitive>[]; |
| 2079 NativeBehavior behavior = new NativeBehavior(); | 2079 NativeBehavior behavior = new NativeBehavior(); |
| 2080 behavior.sideEffects.setAllSideEffects(); | 2080 behavior.sideEffects.setAllSideEffects(); |
| 2081 program.addNativeMethod(function); | 2081 program.addNativeMethod(function); |
| 2082 // Construct the access of the target element. | 2082 // Construct the access of the target element. |
| 2083 String code = function.isInstanceMember ? '#.$name' : name; | 2083 String code = function.isInstanceMember ? '#.$name' : name; |
| 2084 if (function.isInstanceMember) { | 2084 if (function.isInstanceMember) { |
| 2085 arguments.add(state.thisParameter); | 2085 arguments.add(state.thisParameter); |
| 2086 } | 2086 } |
| 2087 // Collect all parameters of the function and templates for them to be | 2087 // Collect all parameters of the function and templates for them to be |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 } | 2886 } |
| 2887 | 2887 |
| 2888 class SwitchCaseInfo { | 2888 class SwitchCaseInfo { |
| 2889 final List<ir.Primitive> constants = <ir.Primitive>[]; | 2889 final List<ir.Primitive> constants = <ir.Primitive>[]; |
| 2890 final SubbuildFunction buildBody; | 2890 final SubbuildFunction buildBody; |
| 2891 | 2891 |
| 2892 SwitchCaseInfo(this.buildBody); | 2892 SwitchCaseInfo(this.buildBody); |
| 2893 | 2893 |
| 2894 void addConstant(ir.Primitive constant) => constants.add(constant); | 2894 void addConstant(ir.Primitive constant) => constants.add(constant); |
| 2895 } | 2895 } |
| OLD | NEW |