KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > compiler > YieldNodeCompiler


1 /*
2  * YieldNodeCompiler.java
3  *
4  * Created on January 31, 2007, 1:00 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.jruby.compiler;
11
12 import org.jruby.ast.Node;
13 import org.jruby.ast.YieldNode;
14
15 /**
16  *
17  * @author headius
18  */

19 public class YieldNodeCompiler implements NodeCompiler {
20     
21     /** Creates a new instance of YieldNodeCompiler */
22     public YieldNodeCompiler() {
23     }
24     
25     public void compile(Node node, Compiler JavaDoc context) {
26         context.lineNumber(node.getPosition());
27         
28         YieldNode yieldNode = (YieldNode)node;
29         
30         if (yieldNode.getArgsNode() != null) {
31             NodeCompilerFactory.getCompiler(yieldNode.getArgsNode()).compile(yieldNode.getArgsNode(), context);
32         }
33         
34         context.yield(yieldNode.getArgsNode() != null);
35     }
36 }
37
Popular Tags