01: /*
02: * $Id: NoMatchNode.java,v 1.6 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.codec.Code;
14: import anvil.script.compiler.ByteCompiler;
15: import anvil.script.Context;
16: import java.io.IOException;
17:
18: /**
19: * class NoMatchNode
20: *
21: * @author: Jani Lehtimäki
22: */
23: public class NoMatchNode extends BinaryParent {
24:
25: public NoMatchNode(Node left, Node right) {
26: super (left, right);
27: }
28:
29: public int typeOf() {
30: return Node.EXPR_NO_MATCH;
31: }
32:
33: public Any eval() {
34: return Context.match(null, _left.eval(), _right.eval()) ? Any.FALSE
35: : Any.TRUE;
36: }
37:
38: public void compile(ByteCompiler context, int operation) {
39: Code code = context.getCode();
40: code.aload_first();
41: super .compile(context, GET);
42: code
43: .invokestatic(code
44: .getPool()
45: .addMethodRef(context.TYPE_CONTEXT, "nomatch",
46: "(Lanvil/script/Context;Lanvil/core/Any;Lanvil/core/Any;)Z"));
47: if (operation != GET_BOOLEAN) {
48: context.boolean2any();
49: }
50: }
51:
52: }
|