/*
* $Id: ThisNode.java,v 1.12 2002/09/16 08:05:05 jkl Exp $
*
* Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
*
* Use is subject to license terms, as defined in
* Anvil Sofware License, Version 1.1. See LICENSE
* file, or http://njet.org/license-1.1.txt
*/
package anvil.script.expression;
import anvil.core.Any;
import anvil.core.AnyClass;
import anvil.codec.Code;
import anvil.script.compiler.ByteCompiler;
import anvil.script.Context;
import anvil.script.ClassType;
import java.io.IOException;
/**
* class ThisNode
*
* @author: Jani Lehtimki
*/
public class ThisNode extends Node
{
public static final ThisNode INSTANCE = new ThisNode(null, null);
protected ClassType _context;
protected ClassType _class;
public ThisNode(ClassType context, ClassType classtype)
{
super();
_context = context;
_class = classtype;
}
public int typeOf()
{
return Node.EXPR_THIS;
}
public boolean isConstant()
{
return false;
}
public Node optimize()
{
return this;
}
public void compile(ByteCompiler context, int operation)
{
context.accessInstance(_context, _class);
//context.getCode().self();
if (operation == GET_BOOLEAN) {
context.any2boolean();
}
}
}
|