On Thu, Nov 24, 2016 at 1:17 AM, Francisco Tolmasky <[email protected]> wrote: > I'd like to replicate the effect of eval in a C++ function. In other words, > I'd like to be able to eval and affect the current HandleScope. So if I do > "var x = 10", I'd like the HandleScope to get a x added, not for the > Context's global to receive the x. Is this possible? > > I suppose a parallel question is, can I "push" a scope for Script->Run? > Basically, I'd like successive Runs to modify the same scope, not the > global, the same way successive evals. > > Thanks, > > Francisco
I think the closest you can get is v8::ScriptCompiler::CompileFunctionInContext(). It lets you compile code in function context with control over its arguments and captured variables. Another approach is to intercept all global property accesses with v8::ObjectTemplate::SetHandler() but that can be very slow. -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
