mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
4ef25a301c
I'm working on a project which uses rhino. I wanted to have finer control over class generation and saving so I've done some patching and clean up on the current rhino tip. The biggest change I've made is the replacement of ClassOutput with ClassRepository that has the single method: public boolean storeClass(String className, byte[] classBytes, boolean isTopLevel) throws IOException; This interface allows any arbitary storage method, such as a Hashtable/Map. In addition it also allows you to specify whether a class should be loaded, via returning true or false. You can still use ClassOutput as I've coded an internal wrapper. With this interface it has also been possible to strip out the file saving code from Codegen and OptClassNameHelper. The file saving code is now an inner class FileClassRepository in Context. As a consequence of this I've stripped out some methods from ClassNameHelper. The resulting code is much more cleaner then before hand and everything still works as per usual. Other small additions are: o Annonymous functions are now named class$1 instead of class1 o get/setClassName added to ClassNameHelper exposed in Context. My final thoughts are, since all methods in ClassNameHelper except reset() are now exposed whould n't it be much more "cleaner" to simply to some how work around to eliminate reset() and provide getClassNameHelper() via Context? You could then remove the numerous ClassNameHelper shadow methods from Context. Likewise, FileClassRepository could be made a public class very easily and combined with the above result in a dozen or so less public methods in Context. Anyway, the changes can be found on http://www.cins.co.uk/rhino.zip Hope it is of use to some Kemal Bayram |
||
---|---|---|
.. | ||
benchmarks | ||
jsd | ||
jsdj | ||
jsj | ||
macbuild | ||
ref | ||
rhino | ||
src | ||
tests | ||
.cvsignore | ||
landbranch.pl | ||
Makefile.in | ||
makefile.win |