org.millscript.millscript.expr
Class CaseExpr

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<Action>
      extended by org.millscript.millscript.expr.CaseExpr

public final class CaseExpr
extends Expr<Action>

This class implements a case expression. An individual case expression can match multiple patterns.

See Also:
SwitchSyntax, SwitchAction

Constructor Summary
CaseExpr(org.millscript.commons.util.IList<Expr> a, Expr<?> b)
          Creates a new case expression from the specified patterns and body expression.
 
Method Summary
 Action compileIt()
          Compiles this expression into an action.
 Expr<?> getAct()
          Returns this case expressions body expression.
 org.millscript.commons.util.IList<Expr<?>> getPatterns()
          Returns this case expressions patterns.
 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

CaseExpr

public CaseExpr(org.millscript.commons.util.IList<Expr> a,
                Expr<?> b)
Creates a new case expression from the specified patterns and body expression.

Parameters:
a - a list of pattern expressions
b - the body expression
Method Detail

compileIt

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

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

getAct

public Expr<?> getAct()
Returns this case expressions body expression.

Returns:
this expressions body expression

getPatterns

public org.millscript.commons.util.IList<Expr<?>> getPatterns()
Returns this case expressions patterns.

Returns:
an immutable list containing this expressions pattern expressions

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<Action>
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.