3 PP1006
Nikolai Tillmann edited this page 2018-05-10 10:59:30 -07:00

Internal slot $Name modified in a nested context. This is not yet supported.

This error would typically only occur in an optimized function when an internal slot, as specified by the JavaScript spec, gets mutated in a conditional context.

This error indicates that you have hit a limitation in Prepack. Try to rearrange your code to overcome the limitation, or feel free to file an issue on GitHub with a feature request that a particular named internal slot should be supported.

For example, the error is triggered by the following code:

let p = {};
function f(c) {
  let o = {};
  if (c) {
    o.__proto__ = p;
    throw o;
  }
}
__optimize(f);

Here, the __proto__ assignment modifies the $Prototype internal slot. Prepack may currently not be able to generate code when this happens in a conditionally nested block. To work around the issue, make the modification unconditional:

let p = {};
function f(c) {
  let o = {};
  o.__proto__ = p;
  if (c) {
    throw o;
  }
}
__optimize(f);