| 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; |
| 11 final Compiler compiler; | 11 final Compiler compiler; |
| 12 final JavaScriptBackend backend; | 12 final JavaScriptBackend backend; |
| 13 final ClosedWorld closedWorld; |
| 13 | 14 |
| 14 ParameterStubGenerator(this.compiler, this.namer, this.backend); | 15 ParameterStubGenerator( |
| 16 this.compiler, this.namer, this.backend, this.closedWorld); |
| 15 | 17 |
| 16 Emitter get emitter => backend.emitter.emitter; | 18 Emitter get emitter => backend.emitter.emitter; |
| 17 CodeEmitterTask get emitterTask => backend.emitter; | 19 CodeEmitterTask get emitterTask => backend.emitter; |
| 18 DiagnosticReporter get reporter => compiler.reporter; | 20 DiagnosticReporter get reporter => compiler.reporter; |
| 19 | 21 |
| 20 bool needsSuperGetter(FunctionElement element) => | 22 bool needsSuperGetter(FunctionElement element) => |
| 21 compiler.codegenWorld.methodsNeedingSuperGetter.contains(element); | 23 compiler.codegenWorld.methodsNeedingSuperGetter.contains(element); |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * Generates stubs to handle invocation of methods with optional | 26 * Generates stubs to handle invocation of methods with optional |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 262 } |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 | 265 |
| 264 // Now run through the actual member selectors (eg. `foo$2(x, y)` and not | 266 // Now run through the actual member selectors (eg. `foo$2(x, y)` and not |
| 265 // `call$2(x, y)`. Some of them have already been generated because of the | 267 // `call$2(x, y)`. Some of them have already been generated because of the |
| 266 // call-selectors (and they are in the renamedCallSelectors set. | 268 // call-selectors (and they are in the renamedCallSelectors set. |
| 267 for (Selector selector in selectors.keys) { | 269 for (Selector selector in selectors.keys) { |
| 268 if (renamedCallSelectors.contains(selector)) continue; | 270 if (renamedCallSelectors.contains(selector)) continue; |
| 269 if (!selector.appliesUnnamed(member)) continue; | 271 if (!selector.appliesUnnamed(member)) continue; |
| 270 if (!selectors[selector] | 272 if (!selectors[selector].applies(member, selector, closedWorld)) { |
| 271 .applies(member, selector, compiler.closedWorld)) { | |
| 272 continue; | 273 continue; |
| 273 } | 274 } |
| 274 | 275 |
| 275 if (untypedSelectors.add(selector)) { | 276 if (untypedSelectors.add(selector)) { |
| 276 ParameterStubMethod stub = | 277 ParameterStubMethod stub = |
| 277 generateParameterStub(member, selector, null); | 278 generateParameterStub(member, selector, null); |
| 278 if (stub != null) { | 279 if (stub != null) { |
| 279 stubs.add(stub); | 280 stubs.add(stub); |
| 280 } | 281 } |
| 281 } | 282 } |
| 282 } | 283 } |
| 283 | 284 |
| 284 return stubs; | 285 return stubs; |
| 285 } | 286 } |
| 286 } | 287 } |
| OLD | NEW |