| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.js_emitter.parameter_stub_generator; | 5 library dart2js.js_emitter.parameter_stub_generator; |
| 6 | 6 |
| 7 import '../closure.dart' show ClosureClassElement; | 7 import '../closure.dart' show ClosureClassElement; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (parameters.optionalParametersAreNamed && | 74 if (parameters.optionalParametersAreNamed && |
| 75 callStructure.namedArgumentCount == parameters.optionalParameterCount) { | 75 callStructure.namedArgumentCount == parameters.optionalParameterCount) { |
| 76 // If the selector has the same number of named arguments as the element, | 76 // If the selector has the same number of named arguments as the element, |
| 77 // we don't need to add a stub. The call site will hit the method | 77 // we don't need to add a stub. The call site will hit the method |
| 78 // directly. | 78 // directly. |
| 79 return null; | 79 return null; |
| 80 } | 80 } |
| 81 JavaScriptConstantCompiler handler = backend.constants; | 81 JavaScriptConstantCompiler handler = backend.constants; |
| 82 List<String> names = callStructure.getOrderedNamedArguments(); | 82 List<String> names = callStructure.getOrderedNamedArguments(); |
| 83 | 83 |
| 84 bool isInterceptedMethod = backend.isInterceptedMethod(member); | 84 bool isInterceptedMethod = |
| 85 backend.interceptorData.isInterceptedMethod(member); |
| 85 | 86 |
| 86 // If the method is intercepted, we need to also pass the actual receiver. | 87 // If the method is intercepted, we need to also pass the actual receiver. |
| 87 int extraArgumentCount = isInterceptedMethod ? 1 : 0; | 88 int extraArgumentCount = isInterceptedMethod ? 1 : 0; |
| 88 // Use '$receiver' to avoid clashes with other parameter names. Using | 89 // Use '$receiver' to avoid clashes with other parameter names. Using |
| 89 // '$receiver' works because namer.safeVariableName used for getting | 90 // '$receiver' works because namer.safeVariableName used for getting |
| 90 // parameter names never returns a name beginning with a single '$'. | 91 // parameter names never returns a name beginning with a single '$'. |
| 91 String receiverArgumentName = r'$receiver'; | 92 String receiverArgumentName = r'$receiver'; |
| 92 | 93 |
| 93 // The parameters that this stub takes. | 94 // The parameters that this stub takes. |
| 94 List<jsAst.Parameter> parametersBuffer = | 95 List<jsAst.Parameter> parametersBuffer = |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 generateParameterStub(member, selector, null); | 303 generateParameterStub(member, selector, null); |
| 303 if (stub != null) { | 304 if (stub != null) { |
| 304 stubs.add(stub); | 305 stubs.add(stub); |
| 305 } | 306 } |
| 306 } | 307 } |
| 307 } | 308 } |
| 308 | 309 |
| 309 return stubs; | 310 return stubs; |
| 310 } | 311 } |
| 311 } | 312 } |
| OLD | NEW |