Commit 58b0110
committed
Fix scala-js#4621: Preserve the side effects of JS binary and unary ops.
The emitter wrongly thought that these operators preserve pureness.
However, they can have side effects in two cases:
* For BigInts, division by 0 and unary + throw.
* For custom objects, if their `valueOf()` method throws, it will
be propagated by the JS binary and unary ops.1 parent c27013f commit 58b0110
File tree
2 files changed
+45
-2
lines changed- test-suite/js/src/test/scala/org/scalajs/testsuite/compiler
2 files changed
+45
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
1259 | | - | |
1260 | | - | |
1261 | 1259 | | |
1262 | 1260 | | |
1263 | 1261 | | |
| |||
1346 | 1344 | | |
1347 | 1345 | | |
1348 | 1346 | | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1349 | 1351 | | |
1350 | 1352 | | |
1351 | 1353 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
99 | 140 | | |
100 | 141 | | |
101 | 142 | | |
| |||
0 commit comments