Commit 3040136
committed
[SILGen] Precompute "returned" completion handler indices.
When generating the completion handler that is passed to ObjC methods
that are being called as async Swift functions, the parameters taken by
the generated completion handler are matched up with the values that are
returned from the async function.
Previously, this process was done by starting at the index into the list
of values expected to be returned, adding 1 if the index matched first
the error index and second the flag index, and finally adding 1 to
account for the fact that the initial parameter to the completion
handler is the block_storage parameter.
That strategy was problematic: it failed to increment indices
appropriately because it did not skip past the block_storage parameter
to begin with; it also failed to increment indices appropriately in
certain cases where the flag and error parameters appeared in an
unexpected order (flag first, then error).
Here, the process is made more robust. Now, the indices which
correspond to the block_storage, flag, and error parameters are filtered
out to begin with. The remaining indices can then be indexed into
using the index into the result tuple (or 0 if the result is not a
tuple).
rdar://808470201 parent 910d918 commit 3040136
File tree
4 files changed
+67
-23
lines changed- lib/SILGen
- test/Interpreter
- Inputs
4 files changed
+67
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | | - | |
267 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
268 | 272 | | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
275 | | - | |
276 | | - | |
| 279 | + | |
| 280 | + | |
277 | 281 | | |
278 | 282 | | |
279 | 283 | | |
| |||
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
285 | | - | |
286 | | - | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
381 | 397 | | |
| 398 | + | |
382 | 399 | | |
383 | 400 | | |
384 | 401 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | 402 | | |
393 | 403 | | |
394 | | - | |
| 404 | + | |
395 | 405 | | |
396 | 406 | | |
| 407 | + | |
397 | 408 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments