FileDocCategorySizeDatePackage
UnaryOpExpr.javaAPI DocJava SE 6 API2712Tue Jun 10 00:22:30 BST 2008com.sun.org.apache.xalan.internal.xsltc.compiler

UnaryOpExpr

public final class UnaryOpExpr extends Expression
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen

Fields Summary
private Expression
_left
Constructors Summary
public UnaryOpExpr(Expression left)

	(_left = left).setParent(this);
    
Methods Summary
public booleanhasLastCall()
Returns true if this expressions contains a call to last()

            return(_left.hasLastCall());
    
public booleanhasPositionCall()
Returns true if this expressions contains a call to position(). This is needed for context changes in node steps containing multiple predicates.

	return(_left.hasPositionCall());
    
public voidsetParser(com.sun.org.apache.xalan.internal.xsltc.compiler.Parser parser)

	super.setParser(parser);
	_left.setParser(parser);
    
public java.lang.StringtoString()

	return "u-" + '(" + _left + ')";
    
public voidtranslate(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)

	InstructionList il = methodGen.getInstructionList();
	_left.translate(classGen, methodGen);
	il.append(_type.NEG());
    
public com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypetypeCheck(com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable stable)

	final Type tleft = _left.typeCheck(stable); 
	final MethodType ptype = lookupPrimop(stable, "u-",
					      new MethodType(Type.Void,
							     tleft)); 
	
	if (ptype != null) {
	    final Type arg1 = (Type) ptype.argsType().elementAt(0);
	    if (!arg1.identicalTo(tleft)) {
		_left = new CastExpr(_left, arg1);
	    }
	    return _type = ptype.resultType();
	}

	throw new TypeCheckError(this);