feat: assignment literal analysis and truthy functions - #6452
Conversation
|
@cyyynthia is attempting to deploy a commit to the rollup-js Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report❌ Patch coverage is Please upload reports for the commit 156aef8 to get more accurate results.
Additional details and impacted files@@ Coverage Diff @@
## master #6452 +/- ##
==========================================
- Coverage 98.78% 98.77% -0.02%
==========================================
Files 275 275
Lines 10820 10825 +5
Branches 2886 2891 +5
==========================================
+ Hits 10689 10692 +3
Misses 89 89
- Partials 42 44 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cd8f85b to
b6d5e37
Compare
|
Hmmm, isn't getting rid of polyfills in core-js actually a bad thing? After all, it is polyfilling missing prototype methods. From the diff it looks to me like your change might actually break the |
I think this is a fair point, though perhaps we can preserve this new behaviour as an opt-in config flag instead 🤔 |
b6d5e37 to
67bda73
Compare
Solution is probably to also override deoptimizeArgumentsOnInteractionAtPath and deoptimizePath to forward to this.right for `=`.
lukastaegert
left a comment
There was a problem hiding this comment.
Hi! This looks good in general now, but I found a regression in the updates to AssignmentExpression. I pushed a failing test to demonstrate. Basically if we forward AssignmentExpression.getLiteralValueAtPath to this.right, then we also need to forward deoptimizations of the result to this.right. I managed to get this to produce bugs when using destructuring assignments. Similarly, we should also implement deoptimizeArgumentsOnInteractionAtPath.
I thought about this long in the past and I keep coming back to the fact that the only good reason why one would want to check the truthiness of a built-in prototype method is to do feature-detection, and we must not break those flows.
|
This PR contains:
Are tests included?
Breaking Changes?
Description
This PR addresses 2 shortcomings of Rollup currently:
=. This unlocks analysis of e.g.() => globalThis.value = trueas a side-effectful function returningtrue.requireXXXblocks in core-js).