Retrieving code and scope from a function

30 views
Skip to first unread message

Seiji Sam Lee

unread,
Aug 22, 2012, 1:44:41 AM8/22/12
to v8-u...@googlegroups.com
Hi everybody:

I am building a bson like library (bjason), and I would like encode/decode functions.

Bson allow en/decode code and its scope, but I don't know to get the code nor scope.

Well, code is easy, with ToString(), but in others examples (mainly from mongodb code) it seems that code and scope is extracted using Get(code_sym) and Get(scope_sym) over the Object, with code and scope_sym persistent handles to "code" and "scope".


Can anybody explain me this?

By the way, is it possible to get the scope of a function? that is, bindings done?

For example:

var a=1;

var fx=function(v) { return v+a; }

The scope of fx is: { a }, am I wrong?

Thanks in advance.
Reply all
Reply to author
Forward
0 new messages