[webkit-dev] nested scopes

Raj Kiran Talusani rajkiran.talusani at gmail.com
Tue Feb 24 05:18:12 PST 2009


Hi all,

I am developing a wrapper API on top of JavaScriptCore for integration with
my application.

Here is an overview of my API.

In my application scripts are executed and variables are defined in
different scopes. This example shows the functionality needed.

js_init(); - initialize
js_set_var("abc","2"); - set abc=2 in global scope
js_push_scope(); - create a new scope
js_set_var("abc","4"); - set abc=4 in new scope
js_print_var("abc"); - should print 4 as we are in new scope
js_pop_scope(); - pop most recent scope. i,e. the new scope
js_print_var("abc"); - Now it should print 2 because we are back to global
scope.

My question is what should i be doing in js_push_scope and js_pop_scope so
that a new JavaScript scope is created and destroyed.

I have seen that there is a ScopeChain.cpp/h .. but its not very clear as to
how to use them.

Raj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090224/7e503663/attachment.html>


More information about the webkit-dev mailing list