pub fn dynamic_function(src: &str) -> Result<Value, String>Expand description
Build a callable from a complete function-expression source text — the ONE dynamic-function generator on this frontend.
src is the exact source V8 synthesizes for the construct, WITHOUT the
wrapping parentheses needed to parse it as an expression: those are added
here, and src itself is retained so Function.prototype.toString reports
what V8 reports. The two callers synthesize different text and both shapes
are observable — see stdlib::vm::compile_function for the measured diff.
The body runs in the MODULE scope, never the constructing function’s scope
(20.2.1.1.1 step 26 instantiates a dynamic function’s body against the
global environment). That also makes a var inside the body a function
local: measured on node v26.7.0, new Function('a','var zz = 5; return zz + a')
returns 6 and leaves globalThis.zz undefined.