Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Marking an object as simple

Dominic Gannaway edited this page Aug 30, 2018 · 2 revisions

An abstract object that is returned from an environmental model holds lots of dangers for Prepack, which can result in a lot of error messages and a failure to successfully run Prepack.

If the object is known to be quite simple, it can be marked as such by calling the __makeSimple global function with the object as its argument.

This informs Prepack that getting or setting a property on the object, or converting it to a string or number, or checking if it defines a property or if it is an instance of a constructor function, will neither throw an exception nor make any visible changes to the heap.

Furthermore, simple objects are assumed to not have any symbolic getters/setters, such as [Symbol.hasInstance].