Fortunately, that's not possible. That would be even crazier than
JavaScript's actual scoping rules.


On Thu, Jan 22, 2015 at 4:03 AM, Francisco Tolmasky <[email protected]>
wrote:

> I'm doing some code transformations that require splitting a function in
> two. I was thus wondering if it could be possible to have the second
> function use the context of the first (I know I can have *scripts* share a
> context, but I'd like to do the same with functions). For example:
>
> function original()
> {
> //...
> eval("var x = 5")
> // ...
> return x;
> }
>
> -->
>
> function transformed_1()
> {
> eval("var x = 5")
> }
>
> function transfromed_2()
> {
> return x;
> }
>
> transformed_1(), tranformed_2()
>
> I would need transformed_2 to return 5 after running them in sequence like
> this. I am controlling the execution from the outside, just as if I were to
> do lcontext->Enter then compile/run 2 scripts (that would share a context
> -- I just specifically need features only found in functions thus I can't
> do that unfortunately).
>
> --
> --
> 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.
>

-- 
-- 
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.

Reply via email to