public void compileRoot(Node node, ScriptCompiler context, ASTInspector inspector) {
compileRoot(node, context, inspector, true, true);
}
public void compileRoot(Node node, ScriptCompiler context, ASTInspector inspector, boolean load, boolean main) {
RootNode rootNode = (RootNode) node;
StaticScope staticScope = rootNode.getStaticScope();
context.startScript(staticScope);
// force static scope to claim restarg at 0, so it only implements the [] version of __file__
staticScope.setRestArg(-2);
// create method for toplevel of script
BodyCompiler methodCompiler = context.startFileMethod(null, staticScope, inspector);
Node nextNode = rootNode.getBodyNode();
if (nextNode != null) {
if (nextNode.getNodeType() == NodeType.BLOCKNODE) {
// it's a multiple-statement body, iterate over all elements in turn and chain if it get too long
BlockNode blockNode = (BlockNode) nextNode;