eval() is actually suitable for my use case. But I wanted to get the benefits of the advanced exception handling in V8::Script::Compile(). There is no way for me to get proper stack traces if I use eval(), right?
Thanks a lot for your input on this! -- Felix Geisendörfer aka the_undefined On Sep 11, 11:00 am, Søren Gjesse <[email protected]> wrote: > It is correct that V8::Script::Compile() is being executed in the global > scope. You can of cause use eval in JavaScript to evaluate code in the > context of another function but this requires that you place the eval in the > function source where you want to use it. There is no support in the API for > compiling in the context of an arbitrary function. > For the JavaScript debugger we have a way of actually evaluating code in the > context of where a break point happens, However it requires creating a > temporary context and currently some of the side effects of this evaluation > is not reflected afterwards. See Runtime_DebugEvaluate in runtime.cc for the > glorious details. > > Regards, > Søren > > 2009/9/9 Felix Geisendörfer <[email protected]> > > > > > > > It seems like JS code passed to V8::Script::Compile() is always being > > executed in the global scope. Is it possible to execute JavaScript > > within the scope of the JS function that is currently being called? > > > Thanks a lot for any pointers - I'm very new to V8 and a bit lost > > here, > > -- Felix Geisendörfer aka the_undefined --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
