01: /*
02: * $Id: GlobalNamespaceNode.java,v 1.6 2002/09/16 08:05:04 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.runtime.AnyNamespace;
14: import anvil.ErrorListener;
15: import anvil.codec.Code;
16: import anvil.script.compiler.ByteCompiler;
17: import anvil.script.Context;
18: import java.io.IOException;
19:
20: /**
21: * class GlobalNamespaceNode
22: *
23: * @author: Jani Lehtimäki
24: */
25: public class GlobalNamespaceNode extends Node {
26:
27: public static final GlobalNamespaceNode INSTANCE = new GlobalNamespaceNode();
28:
29: public GlobalNamespaceNode() {
30: super ();
31: }
32:
33: public int typeOf() {
34: return Node.EXPR_NAMESPACE;
35: }
36:
37: public boolean isConstant() {
38: return false;
39: }
40:
41: public Node optimize() {
42: return this ;
43: }
44:
45: public void compile(ByteCompiler context, int operation) {
46: Code code = context.getCode();
47: code.aload_first();
48: code.invokevirtual(code.getPool().addMethodRef(
49: context.TYPE_CONTEXT, "global", "()Lanvil/core/Any;"));
50: if (operation == GET_BOOLEAN) {
51: context.any2boolean();
52: }
53: }
54:
55: }
|