01: /*
02: * AndNodeCompiler.java
03: *
04: * Created on January 12, 2007, 12:38 PM
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.AndNode;
13: import org.jruby.ast.Node;
14:
15: /**
16: *
17: * @author headius
18: */
19: public class AndNodeCompiler implements NodeCompiler {
20:
21: /** Creates a new instance of AndNodeCompiler */
22: public AndNodeCompiler() {
23: }
24:
25: public void compile(Node node, Compiler context) {
26: context.lineNumber(node.getPosition());
27:
28: final AndNode andNode = (AndNode) node;
29:
30: NodeCompilerFactory.getCompiler(andNode.getFirstNode())
31: .compile(andNode.getFirstNode(), context);
32:
33: BranchCallback longCallback = new BranchCallback() {
34: public void branch(Compiler context) {
35: NodeCompilerFactory
36: .getCompiler(andNode.getSecondNode()).compile(
37: andNode.getSecondNode(), context);
38: }
39: };
40:
41: context.performLogicalAnd(longCallback);
42: }
43: }
|