Commit bcbc66e
committed
Parse varargs in a more direct manner
In bytecode, vararg parameters are encoded as arrays with the
ACC_VARARGS flag set on the method. Previously we first parsed them as
arrays then translated the array into a repeated param. With this commit
we directly parse them as repeated params. This isn't really any simpler
since we need to keep track of the fact that we're in a varargs method,
but it will become useful in the next commit where we start treating
arrays differently from varargs (`T[]` will still be translated as
`Array[T & Object]` whereas `T...` will be translated as `T*` and
handled specially in ElimRepeated to preserve soundness).
Similarly for joint compilation, we now directly desugar varargs as
`RepeatedParam[T]` instead of `Array[T] @Repeated`, this doesn't change
anything currently because:
- When giving a type to the method, we call `annotatedToRepeated` on
each parameter type
- `typedAppliedTypeTree` takes care of adding `& Object` for both
`Array[T]` and `RepeatedParam[T]` coming From Java (this is what
the next commit will change).1 parent bc4b401 commit bcbc66e
File tree
3 files changed
+46
-33
lines changed- compiler/src/dotty/tools/dotc
- ast
- core
- classfile
- unpickleScala2
3 files changed
+46
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1684 | 1684 | | |
1685 | 1685 | | |
1686 | 1686 | | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1691 | 1693 | | |
1692 | 1694 | | |
1693 | 1695 | | |
| |||
Lines changed: 40 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | | - | |
| 287 | + | |
287 | 288 | | |
288 | 289 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | 290 | | |
293 | 291 | | |
294 | 292 | | |
| |||
324 | 322 | | |
325 | 323 | | |
326 | 324 | | |
327 | | - | |
| 325 | + | |
328 | 326 | | |
329 | 327 | | |
330 | 328 | | |
| |||
395 | 393 | | |
396 | 394 | | |
397 | 395 | | |
398 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
399 | 418 | | |
400 | 419 | | |
401 | | - | |
| 420 | + | |
402 | 421 | | |
403 | | - | |
404 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
405 | 431 | | |
406 | 432 | | |
407 | 433 | | |
| |||
574 | 600 | | |
575 | 601 | | |
576 | 602 | | |
577 | | - | |
| 603 | + | |
578 | 604 | | |
579 | 605 | | |
580 | 606 | | |
| |||
584 | 610 | | |
585 | 611 | | |
586 | 612 | | |
587 | | - | |
| 613 | + | |
588 | 614 | | |
589 | 615 | | |
590 | 616 | | |
| |||
1103 | 1129 | | |
1104 | 1130 | | |
1105 | 1131 | | |
1106 | | - | |
1107 | | - | |
| 1132 | + | |
| 1133 | + | |
1108 | 1134 | | |
1109 | 1135 | | |
1110 | 1136 | | |
| |||
Lines changed: 0 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 62 | | |
78 | 63 | | |
79 | 64 | | |
| |||
0 commit comments