KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * OrNodeCompiler.java
3  *
4  * Created on January 12, 2007, 1:08 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.OrNode;
14
15 /**
16  *
17  * @author headius
18  */

19 public class OrNodeCompiler implements NodeCompiler{
20     
21     /** Creates a new instance of OrNodeCompiler */
22     public OrNodeCompiler() {
23     }
24     
25     public void compile(Node node, Compiler JavaDoc context) {
26         context.lineNumber(node.getPosition());
27         
28         final OrNode orNode = (OrNode)node;
29         
30         NodeCompilerFactory.getCompiler(orNode.getFirstNode()).compile(orNode.getFirstNode(), context);
31         
32         BranchCallback longCallback = new BranchCallback() {
33             public void branch(Compiler JavaDoc context) {
34                 NodeCompilerFactory.getCompiler(orNode.getSecondNode()).compile(orNode.getSecondNode(), context);
35             }
36         };
37         
38         context.performLogicalOr(longCallback);
39     }
40 }
41
Popular Tags