Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created February 1, 2010 02:08
Show Gist options
  • Save tolmasky/291400 to your computer and use it in GitHub Desktop.
Save tolmasky/291400 to your computer and use it in GitHub Desktop.
function objj_eval(/*String*/ aString)
{
Executable.setCommonJSArguments(require, exports, module, system, print, window);
var executable = preprocess(aString, "", 0),
objj_executeFile = fileExecuterForPath(FILE.cwd()),
objj_importFile = fileImporterForPath(FILE.cwd());
print("i dont understand");try{
if (!executable.hasLoadedFileDependencies()){print("load em up");
executable.loadFileDependencies();}}catch(e) { print("error?" + e); }
print("done with that");
var code = executable._code;
print(code);
if (typeof system !== "undefined" && system.engine === "rhino")
return Packages.org.mozilla.javascript.Context.getCurrentContext().evaluateString(window, code, "objj_eval", 0, NULL);
return eval("(" + code + ")");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment