01: /*
02: * ReturnNodeCompiler.java
03: *
04: * Created on April 7, 2007, 12:41 AM
05: *
06: * To change this template, choose Tools | Template Manager
07: * and open the template in the editor.
08: */
09:
10: package org.jruby.compiler;
11:
12: import org.jruby.ast.Node;
13: import org.jruby.ast.ReturnNode;
14:
15: /**
16: *
17: * @author headius
18: */
19: public class ReturnNodeCompiler implements NodeCompiler {
20:
21: /** Creates a new instance of ReturnNodeCompiler */
22: public ReturnNodeCompiler() {
23: }
24:
25: public void compile(Node node, Compiler context) {
26: context.lineNumber(node.getPosition());
27:
28: ReturnNode returnNode = (ReturnNode) node;
29:
30: NodeCompilerFactory.getCompiler(returnNode.getValueNode())
31: .compile(returnNode.getValueNode(), context);
32:
33: context.performReturn();
34: }
35:
36: }
|