01: /*
02: * $Id: PipeNode.java,v 1.3 2002/09/16 08:05:05 jkl Exp $
03: *
04: * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
05: *
06: * Use is subject to license terms, as defined in
07: * Anvil Sofware License, Version 1.1. See LICENSE
08: * file, or http://njet.org/license-1.1.txt
09: */
10: package anvil.script.expression;
11:
12: import anvil.core.Any;
13: import anvil.core.AnyMap;
14: import anvil.codec.Code;
15: import anvil.codec.ConstantPool;
16: import anvil.script.compiler.ByteCompiler;
17: import anvil.script.Context;
18: import java.io.IOException;
19:
20: /**
21: * class MappingNode
22: *
23: * @author: Jani Lehtimäki
24: */
25: public class PipeNode extends BinaryParent {
26:
27: public PipeNode(Node left, Node right) {
28: super (left, right);
29: }
30:
31: public int typeOf() {
32: return Node.EXPR_MAPPING;
33: }
34:
35: public Node optimize() {
36: optimizeChilds();
37: return this ;
38: }
39:
40: public boolean isConstant() {
41: return false;
42: }
43:
44: public void compile(ByteCompiler context, int operation) {
45: Code code = context.getCode();
46: ConstantPool pool = code.getPool();
47: code.aload_first();
48: _left.compile(context, GET);
49: _right.compile(context, GET);
50: code.invokevirtual(pool.addMethodRef(context.TYPE_CONTEXT,
51: "pipe",
52: "(Lanvil/core/Any;Lanvil/core/Any;)Lanvil/core/Any;"));
53: if (operation == GET_BOOLEAN) {
54: context.any2boolean();
55: }
56: }
57:
58: }
|