Commit dd3a6e6
committed
fix(objects): remove incorrect NO_SIDE_EFFECTS annotations from property definers
The defineGetter, defineLazyGetter, and defineLazyGetters functions mutate
objects by defining properties on them, so they have side effects. The
/*@__NO_SIDE_EFFECTS__*/ annotations caused esbuild to incorrectly tree-shake
these function calls when their return values weren't used, resulting in lazy
getters returning undefined instead of computed values.
Also removed double wrapping in defineLazyGetters where createLazyGetter was
being called unnecessarily before passing to defineLazyGetter (which already
calls createLazyGetter internally).
Fixes three failing tests:
- createConstantsObject > should create object with lazy getters
- defineLazyGetters > should define multiple lazy getters
- defineLazyGetters > should handle symbol keys in getters1 parent 576adaa commit dd3a6e6
2 files changed
+12
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | 275 | | |
277 | 276 | | |
278 | 277 | | |
| |||
309 | 308 | | |
310 | 309 | | |
311 | 310 | | |
312 | | - | |
313 | 311 | | |
314 | 312 | | |
315 | 313 | | |
| |||
346 | 344 | | |
347 | 345 | | |
348 | 346 | | |
349 | | - | |
350 | 347 | | |
351 | 348 | | |
352 | 349 | | |
| |||
356 | 353 | | |
357 | 354 | | |
358 | 355 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
| 356 | + | |
364 | 357 | | |
365 | 358 | | |
366 | 359 | | |
| |||
0 commit comments