public IREvalScript buildEvalRoot(StaticScope staticScope, IRScope containingScope, String file, int lineNumber, RootNode rootNode) { // Top-level script! IREvalScript script = new IREvalScript(manager, containingScope, file, lineNumber, staticScope); // Debug info: record line number script.addInstr(new LineNumberInstr(script, lineNumber)); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree Operand rval = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode(), script); script.addInstr(new ReturnInstr(rval)); return script; }
public IREvalScript buildEvalRoot(StaticScope staticScope, IRScope containingScope, String file, int lineNumber, RootNode rootNode) { // Top-level script! IREvalScript script = new IREvalScript(manager, containingScope, file, lineNumber, staticScope); // Debug info: record line number script.addInstr(new LineNumberInstr(script, lineNumber)); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree Operand rval = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode(), script); script.addInstr(new ReturnInstr(rval)); return script; }