This partially reverts changes done in #2567, as the clearing of state was a bit too invasive. It is fully possible to have functions that both call callbacks and return values, which was made impossible by this change.
I kept the tests, which proves this fix is not affecting the intent of the original fix, and additionally added a regression test for #2572 to make sure it keeps that way.
How to verify - mandatory
Check out this branch
npm install
Checklist for author
[x] npm run lint passes
[x] References to standard library functions are cached.
Purpose (TL;DR) - mandatory
This partially reverts changes done in #2567, as the clearing of state was a bit too invasive. It is fully possible to have functions that both call callbacks and return values, which was made impossible by this change.
I kept the tests, which proves this fix is not affecting the intent of the original fix, and additionally added a regression test for #2572 to make sure it keeps that way.
How to verify - mandatory
npm install
Checklist for author
npm run lint
passes