Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
Herman Venter edited this page Aug 8, 2018 · 2 revisions

Side-effects from mutating a property/binding or throwing

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 optimized 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.

Clone this wiki locally