Goal is for js::core::Context to be a pure interpreter (ie - we don't insert anything that QuickJS doesn't), and a vaguely readable interface. This PR works towards the latter by shuffling methods around, removing a few unused/unnecessary overloads, and the former by introducing an Extension pattern rather than populate_global_XXX methods on the Context.
A goal of this extension pattern is the removal of the messy globals object on Context - previously lots of inserted calls relied on the globals.tx object inserted to support the ccf.kv functions. Now they explicitly use the state in their own extension, including a Tx* where necessary. This should also simplify cleanup, as its a case of deleting extensions rather than invalidating global values.
[x] Manually verify what we expose in each execution context hasn't changed, see if that can be automated. (EDIT: Manually verified that we insert exactly the same globals, but with a bunch of hacks and manually string mangling. Will punt on automating this for now.
Goal is for
js::core::Context
to be a pure interpreter (ie - we don't insert anything that QuickJS doesn't), and a vaguely readable interface. This PR works towards the latter by shuffling methods around, removing a few unused/unnecessary overloads, and the former by introducing anExtension
pattern rather thanpopulate_global_XXX
methods on theContext
.A goal of this extension pattern is the removal of the messy
globals
object onContext
- previously lots of inserted calls relied on theglobals.tx
object inserted to support theccf.kv
functions. Now they explicitly use the state in their own extension, including aTx*
where necessary. This should also simplify cleanup, as its a case of deleting extensions rather than invalidating global values.