On Mon, Sep 17, 2012 at 1:55 PM, Christoph T. <[email protected]> wrote:
> I'd like to code an aspect oriented language extension for JavaScript. My
> aspects should be defined in JavaScript. To weave in my advices I need a
> list of all objects which are currently available within the current
> context, to match their names e.g. against a regular expression to find out
> if the new advice should be woven in. Is there a function within JavaScript
> I can call to simply get this list?
This can only be done on a per-object basis, but you can get access to the
top-level list of objects via the global object with code similar to the
following (run in the global scope):
var k, v;
for( k in this ) {
if(!this.hasOwnProperty(k)) continue;
v = this[k];
... do your bit here ...
}
AFAIK there is no standard way to get the names of vars from a scope, e.g.:
function foo(){
var x, y, z;
... there is no standard way to derive the names x/y/z here ...
... either you know them or you don't ...
}
and i'm not sure that there's even a non-standard way to do it.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users