org.millscript.millscript.expr
Class VarExpr

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<VarAction>
      extended by org.millscript.millscript.expr.VarExpr

public final class VarExpr
extends Expr<VarAction>

This class implements a variable declaration expression. This can declare new variables and constants.

See Also:
VarSyntax, VarAlienAction, VarGlobalAction, VarLocalAction

Constructor Summary
VarExpr(boolean isconst, NameExpr a, Expr<?> b)
          Creates a new variable expression, to declare a variable/constant, with the specified name and value.
 
Method Summary
 VarAction compileIt()
          Compiles this expression into an action.
 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

VarExpr

public VarExpr(boolean isconst,
               NameExpr a,
               Expr<?> b)
Creates a new variable expression, to declare a variable/constant, with the specified name and value. The value expression must return a single result.

Parameters:
isconst - true if this expression declares a new constant, false otherwise.
a - the name expression for the declared variable
b - the value expression for the declared variable
Method Detail

compileIt

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

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