-
Notifications
You must be signed in to change notification settings - Fork 424
PP1007
The message will tell you the name and location of a binding, property, global object property or throw statement that modifies the environment outside of an optimzed function.
To suppress this warning, you can hide the state mutation inside of an abstract function.
Usually, optimized functions should be pure, as Prepack doesn't always properly handle mutations to state that is not local to the optimized function.
Generally, in this case, Prepack will emit code that will perform the first update correctly assuming that the state is as it was at the end of global evaluation. This is useful for the case of caching.
Prepack will not generally serialize updates to non-local state of optimized functions correctly unless the state being updated is abstract before the evaluation of the optimized function. See this test case for an example of how the update fails when the value being updated is concrete. In this case, Prepack serializes i
as 1
or 2
without the +=
operation.