{{ message }}
Repository navigation
Commit e9b5468
committed
Keep a modifier's statement on its line for backtraces only
To report the right line for `foo "a", "x\ny" unless cond`
(#9293), fixpos makes the statement
of a modifier conditional a newline node. With coverage on, that made it
a line event of its own, counted on a line the parser never marked: a
multi-line statement before its condition, as in `foo 1,\n 2 if y`,
read 0 on its first line where MRI reports nil.
A node can now be a newline for backtraces only: the IR builder restores
its line without a coverage event, and Coverage.line_stub skips it.
In an interpolation, prism unsets the newline flag of a lone statement
even when it is a conditional. The conditional's statements remain line
events, and a modifier's statement, whose own event the conditional's
otherwise hides, then counts: `"#{n} item#{'s' unless n == 1}"` counts
its line once more, as in MRI.1 parent 89c158f commit e9b5468
6 files changed
Lines changed: 64 additions & 9 deletions
File tree
- core/src/main/java/org/jruby
- ast
- ir/builder
- parser
- test/jruby
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
80 | 101 | | |
81 | 102 | | |
82 | 103 | | |
83 | 104 | | |
84 | 105 | | |
| 106 | + | |
85 | 107 | | |
86 | 108 | | |
87 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | | - | |
| 792 | + | |
| 793 | + | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
800 | | - | |
801 | 799 | | |
802 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
803 | 812 | | |
804 | 813 | | |
805 | 814 | | |
| |||
1767 | 1776 | | |
1768 | 1777 | | |
1769 | 1778 | | |
1770 | | - | |
1771 | | - | |
1772 | | - | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
1773 | 1783 | | |
1774 | 1784 | | |
1775 | 1785 | | |
| |||

0 commit comments