org.millscript.millscript.expr
Class NoneExpr

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<NoneAction>
      extended by org.millscript.millscript.expr.NoneExpr
All Implemented Interfaces:
ZeroResults

public final class NoneExpr
extends Expr<NoneAction>
implements ZeroResults

This class implements a none expression. This expression will never return any results.

See Also:
NoneSyntax, NoneAction

Constructor Summary
NoneExpr(Expr<?> x)
          Creates a new none expression for the specified expression.
 
Method Summary
 NoneAction compileIt()
          Compiles this expression into an action.
static Expr<?> make(Expr<?> x)
          Returns the specified expression ensuring it will return zero results.
 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

NoneExpr

public NoneExpr(Expr<?> x)
Creates a new none expression for the specified expression.

Parameters:
x - the expression to evaluate
Method Detail

make

public static Expr<?> make(Expr<?> x)
Returns the specified expression ensuring it will return zero results. This method provides some compile-time optimisation, as it avoids creating additional unnecessary objects in the expression tree. If the specified expression is already returns zero results, we simply return it, otherwise we proceed to wrap it in a new none expression.

Parameters:
x - the expression for which to discard results
Returns:
the specified expression if it returns zero results, or a new NoneExpr for the specified expression

compileIt

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

Specified by:
compileIt in class Expr<NoneAction>
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<NoneAction>
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.