| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 Set<Selector> untypedSelectors = new Set<Selector>(); | 242 Set<Selector> untypedSelectors = new Set<Selector>(); |
| 243 | 243 |
| 244 // Start with the callSelectors since they imply the generation of the | 244 // Start with the callSelectors since they imply the generation of the |
| 245 // non-call version. | 245 // non-call version. |
| 246 for (Selector selector in callSelectors.keys) { | 246 for (Selector selector in callSelectors.keys) { |
| 247 Selector renamedSelector = | 247 Selector renamedSelector = |
| 248 new Selector.call(member.memberName, selector.callStructure); | 248 new Selector.call(member.memberName, selector.callStructure); |
| 249 renamedCallSelectors.add(renamedSelector); | 249 renamedCallSelectors.add(renamedSelector); |
| 250 | 250 |
| 251 if (!renamedSelector.appliesUnnamed(member, compiler.backend)) { | 251 if (!renamedSelector.appliesUnnamed(member)) { |
| 252 continue; | 252 continue; |
| 253 } | 253 } |
| 254 | 254 |
| 255 if (untypedSelectors.add(renamedSelector)) { | 255 if (untypedSelectors.add(renamedSelector)) { |
| 256 ParameterStubMethod stub = | 256 ParameterStubMethod stub = |
| 257 generateParameterStub(member, renamedSelector, selector); | 257 generateParameterStub(member, renamedSelector, selector); |
| 258 if (stub != null) { | 258 if (stub != null) { |
| 259 stubs.add(stub); | 259 stubs.add(stub); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 // Now run through the actual member selectors (eg. `foo$2(x, y)` and not | 264 // 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 | 265 // `call$2(x, y)`. Some of them have already been generated because of the |
| 266 // call-selectors (and they are in the renamedCallSelectors set. | 266 // call-selectors (and they are in the renamedCallSelectors set. |
| 267 for (Selector selector in selectors.keys) { | 267 for (Selector selector in selectors.keys) { |
| 268 if (renamedCallSelectors.contains(selector)) continue; | 268 if (renamedCallSelectors.contains(selector)) continue; |
| 269 if (!selector.appliesUnnamed(member, backend)) continue; | 269 if (!selector.appliesUnnamed(member)) continue; |
| 270 if (!selectors[selector] | 270 if (!selectors[selector] |
| 271 .applies(member, selector, compiler.closedWorld)) { | 271 .applies(member, selector, compiler.closedWorld)) { |
| 272 continue; | 272 continue; |
| 273 } | 273 } |
| 274 | 274 |
| 275 if (untypedSelectors.add(selector)) { | 275 if (untypedSelectors.add(selector)) { |
| 276 ParameterStubMethod stub = | 276 ParameterStubMethod stub = |
| 277 generateParameterStub(member, selector, null); | 277 generateParameterStub(member, selector, null); |
| 278 if (stub != null) { | 278 if (stub != null) { |
| 279 stubs.add(stub); | 279 stubs.add(stub); |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 return stubs; | 284 return stubs; |
| 285 } | 285 } |
| 286 } | 286 } |
| OLD | NEW |