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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // We need to pay attention if this stub is for a function that has been | 210 // We need to pay attention if this stub is for a function that has been |
211 // invoked from a subclass. Then we cannot just redirect, since that | 211 // invoked from a subclass. Then we cannot just redirect, since that |
212 // would invoke the methods of the subclass. We have to compile to: | 212 // would invoke the methods of the subclass. We have to compile to: |
213 // (1) foo$2(a, b) => MyClass.foo$4$c$d.call(this, a, b, null, null) | 213 // (1) foo$2(a, b) => MyClass.foo$4$c$d.call(this, a, b, null, null) |
214 // (2) foo$3$c(a, b, c) => MyClass.foo$4$c$d(this, a, b, c, null); | 214 // (2) foo$3$c(a, b, c) => MyClass.foo$4$c$d(this, a, b, c, null); |
215 // (3) foo$3$d(a, b, d) => MyClass.foo$4$c$d(this, a, b, null, d); | 215 // (3) foo$3$d(a, b, d) => MyClass.foo$4$c$d(this, a, b, null, d); |
216 List<ParameterStubMethod> generateParameterStubs(MethodElement member, | 216 List<ParameterStubMethod> generateParameterStubs(MethodElement member, |
217 {bool canTearOff: true}) { | 217 {bool canTearOff: true}) { |
218 if (member.enclosingElement.isClosure) { | 218 if (member.enclosingElement.isClosure) { |
219 ClosureClassElement cls = member.enclosingElement; | 219 ClosureClassElement cls = member.enclosingElement; |
220 if (cls.supertype.element == backend.helpers.boundClosureClass) { | 220 if (cls.supertype.element == backend.commonElements.boundClosureClass) { |
221 reporter.internalError(cls.methodElement, 'Bound closure1.'); | 221 reporter.internalError(cls.methodElement, 'Bound closure1.'); |
222 } | 222 } |
223 if (cls.methodElement.isInstanceMember) { | 223 if (cls.methodElement.isInstanceMember) { |
224 reporter.internalError(cls.methodElement, 'Bound closure2.'); | 224 reporter.internalError(cls.methodElement, 'Bound closure2.'); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 // The set of selectors that apply to `member`. For example, for | 228 // The set of selectors that apply to `member`. For example, for |
229 // a member `foo(x, [y])` the following selectors may apply: | 229 // a member `foo(x, [y])` the following selectors may apply: |
230 // `foo(x)`, and `foo(x, y)`. | 230 // `foo(x)`, and `foo(x, y)`. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 generateParameterStub(member, selector, null); | 303 generateParameterStub(member, selector, null); |
304 if (stub != null) { | 304 if (stub != null) { |
305 stubs.add(stub); | 305 stubs.add(stub); |
306 } | 306 } |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 return stubs; | 310 return stubs; |
311 } | 311 } |
312 } | 312 } |
OLD | NEW |