org.millscript.millscript.expr
Class AssignExpr

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

public final class AssignExpr
extends Expr<AssignAction>
implements ZeroResults

This class implements an assign expression. This expression will never return any results.

See Also:
AssignSyntax, ApplyUpdaterExpr, AssignAlienAction, AssignGlobalAction, AssignLocalAction

Constructor Summary
AssignExpr(NameExpr l, Expr<?> r)
          Creates a new assign expression for the specified name and value expressions.
 
Method Summary
 AssignAction compileIt()
          Compiles this expression into an action.
static Expr make(Expr l, Expr r)
          Returns an expression to assign the result of the right hand side expression to the result of the left hand side 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

AssignExpr

public AssignExpr(NameExpr l,
                  Expr<?> r)
Creates a new assign expression for the specified name and value expressions.

Parameters:
l - the name expression to assign to
r - the value expression to assign from, which should return a single result
Method Detail

make

public static Expr make(Expr l,
                        Expr r)
Returns an expression to assign the result of the right hand side expression to the result of the left hand side expression. This is required to handle the situation where the left hand side is a function, and we have to apply the updater for the function, rather than assign to it.

Parameters:
l - the expression to assign to, this should be an ApplyExpr or NameExpr
r - the expression to assign from
Returns:
an ApplyUpdaterExpr if the left hand side is an ApplyExpr, otherwise an AssignExpr

compileIt

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

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