| 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class ParameterStubGenerator { | 7 class ParameterStubGenerator { |
| 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); | 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); |
| 9 | 9 |
| 10 final Namer namer; | 10 final Namer namer; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // We need to pay attention if this stub is for a function that has been | 183 // We need to pay attention if this stub is for a function that has been |
| 184 // invoked from a subclass. Then we cannot just redirect, since that | 184 // invoked from a subclass. Then we cannot just redirect, since that |
| 185 // would invoke the methods of the subclass. We have to compile to: | 185 // would invoke the methods of the subclass. We have to compile to: |
| 186 // (1) foo$2(a, b) => MyClass.foo$4$c$d.call(this, a, b, null, null) | 186 // (1) foo$2(a, b) => MyClass.foo$4$c$d.call(this, a, b, null, null) |
| 187 // (2) foo$3$c(a, b, c) => MyClass.foo$4$c$d(this, a, b, c, null); | 187 // (2) foo$3$c(a, b, c) => MyClass.foo$4$c$d(this, a, b, c, null); |
| 188 // (3) foo$3$d(a, b, d) => MyClass.foo$4$c$d(this, a, b, null, d); | 188 // (3) foo$3$d(a, b, d) => MyClass.foo$4$c$d(this, a, b, null, d); |
| 189 List<ParameterStubMethod> generateParameterStubs(MethodElement member, | 189 List<ParameterStubMethod> generateParameterStubs(MethodElement member, |
| 190 {bool canTearOff: true}) { | 190 {bool canTearOff: true}) { |
| 191 if (member.enclosingElement.isClosure) { | 191 if (member.enclosingElement.isClosure) { |
| 192 ClosureClassElement cls = member.enclosingElement; | 192 ClosureClassElement cls = member.enclosingElement; |
| 193 if (cls.supertype.element == backend.boundClosureClass) { | 193 if (cls.supertype.element == backend.helpers.boundClosureClass) { |
| 194 reporter.internalError(cls.methodElement, 'Bound closure1.'); | 194 reporter.internalError(cls.methodElement, 'Bound closure1.'); |
| 195 } | 195 } |
| 196 if (cls.methodElement.isInstanceMember) { | 196 if (cls.methodElement.isInstanceMember) { |
| 197 reporter.internalError(cls.methodElement, 'Bound closure2.'); | 197 reporter.internalError(cls.methodElement, 'Bound closure2.'); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 // The set of selectors that apply to `member`. For example, for | 201 // The set of selectors that apply to `member`. For example, for |
| 202 // a member `foo(x, [y])` the following selectors may apply: | 202 // a member `foo(x, [y])` the following selectors may apply: |
| 203 // `foo(x)`, and `foo(x, y)`. | 203 // `foo(x)`, and `foo(x, y)`. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 generateParameterStub(member, selector, null); | 275 generateParameterStub(member, selector, null); |
| 276 if (stub != null) { | 276 if (stub != null) { |
| 277 stubs.add(stub); | 277 stubs.add(stub); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 return stubs; | 282 return stubs; |
| 283 } | 283 } |
| 284 } | 284 } |
| OLD | NEW |