It doesn't look like anyone with better experience than me has responded yet, so I'll throw in my best idea here. My approach to this would probably be to parse the byte code generated after compiling the script and look for the operations that load a variable, I haven't looked into this specifically, but there is probably a limited set of such operations that you need to consider. In the parser code there are a couple of lists of operations and tokens which are not too impossible to figure out, I looked through them a bit for some custom functionality I was working on.
Maybe it's not the perfect answer, but perhaps it will give you some ideas. David -----Original Message----- From: dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozilla.org [mailto:dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozill a.org] On Behalf Of Nick Sent: Saturday, August 22, 2009 1:22 PM To: [email protected] Subject: Way to find names of properties referenced by script Hi there, I'm wondering if there is a way in Rhino to compile a piece of javascript and then find out what properties, etc., will need to be provided when it is evaluated. I would like to determine the dependencies of the script from the script itself, so that only the required values can be added to the context at evaluation time. Appreciate any info or suggestions. Nick _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
