1 28 29 package org.jruby.compiler; 30 31 import org.jruby.ast.Node; 32 import org.jruby.ast.RootNode; 33 34 38 public class RootNodeCompiler implements NodeCompiler { 39 40 41 public RootNodeCompiler() { 42 } 43 44 public void compile(Node node, Compiler context) { 45 RootNode rootNode = (RootNode)node; 46 47 context.startScript(); 48 49 Object methodToken = context.beginMethod("__file__", 0, rootNode.getStaticScope().getNumberOfVariables()); 51 52 try { 54 Node nextNode = rootNode.getBodyNode(); 55 if (nextNode != null) { 56 NodeCompilerFactory.getCompiler(nextNode).compile(nextNode, context); 57 } 58 } catch (NotCompilableException nce) { 59 throw nce; 61 } 62 63 context.endMethod(methodToken); 64 65 context.endScript(); 66 } 67 } 68 | Popular Tags |