org.millscript.millscript.expr
Class NotExpr

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<NotAction>
      extended by org.millscript.millscript.expr.NotExpr
All Implemented Interfaces:
OneResult

public final class NotExpr
extends Expr<NotAction>
implements OneResult

This class implements a not expression. This expression always returns one result.

See Also:
NotSyntax, NotAction

Constructor Summary
NotExpr(Expr<?> x)
          Creates a new not expression to negate the result of the specified expression.
 
Method Summary
 NotAction compileIt()
          Compiles this expression into an action.
static Expr<?> make(Expr x)
          Returns an expression which negates the specified expression.
 void resolve(CompilerState state)
          Resolves any NameExpr in the tree so that they refer to the correct ident.
 
Methods inherited from class org.millscript.millscript.expr.Expr
arity, compile, isIntegerExpr, resolveList, setLineNumber, setOrigin, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotExpr

public NotExpr(Expr<?> x)
Creates a new not expression to negate the result of the specified expression.

Parameters:
x - the expression whose result to negate
Method Detail

make

public static Expr<?> make(Expr x)
Returns an expression which negates the specified expression. This method provides some compile-time optimisation, as it avoids creating additional unnecessary objects in the expression tree. If the specified expression is already a not expression, we return it's expression to be negated. Otherwise we return a new not expression.

Parameters:
x - the expression whose result to be negated
Returns:
a NotExpr if the specified expression is not already NotExpr, otherwise we return the specified expressions body expression.

compileIt

public NotAction compileIt()
Description copied from class: Expr
Compiles this expression into an action.

Specified by:
compileIt in class Expr<NotAction>
Returns:
the Action for this expression
See Also:
Expr.compileIt()

resolve

public void resolve(CompilerState state)
Description copied from class: Expr
Resolves any NameExpr in the tree so that they refer to the correct ident. e.g. This method is responsible for ensuring that references to a function argument in the body of a function actually refer to the correct value.

Specified by:
resolve in class Expr<NotAction>
Parameters:
state - the compiler state we are resolving in
See Also:
Expr.resolve(org.millscript.millscript.vm.CompilerState)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.