public class CaseExp extends Expression
case case-key case-clause+ case case-key case-clause* case-else-clause case-key ::= expression case-clause ::=((datum*)expression+)|((datum*) =>expression)case-else-clause ::= (else expression+) |(else =>expression)
| Modifier and Type | Class and Description |
|---|---|
static class |
CaseExp.CaseClause
This class represent a clause of the case expression,
of the form ((datum*) expression+) or (else expression+)
|
SourceLocator.Simple applyMethodExpression, flags, NEXT_AVAIL_FLAG, noExpressions, type, VALIDATED applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey nameKey | Constructor and Description |
|---|
CaseExp (Expression key,
CaseExp.CaseClause[] clauses)
Constructor for a case expression with no else clause.
|
CaseExp (Expression key,
CaseExp.CaseClause[] clauses,
CaseExp.CaseClause elseClause)
Constructor for a case expression with an else clause.
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply (CallContext ctx)
Evaluate the expression.
|
protected Type |
calculateDatumsType ()
Computes the union type of the case expression datums.
|
protected java.lang.Object |
calculateDatumValue (Expression datum)
Given the expression generated from a datum
returns the value of the datum as an Object.
|
protected Type |
calculateType () |
void |
compile (Compilation comp,
Target target) |
protected boolean |
mustCompile () |
void |
print (gnu.kawa.io.OutPort out) |
boolean |
searchValue (java.lang.Object keyValue)
Search a clause containing the specified key.
|
Expression |
selectCase (java.lang.Object keyValue)
Search for a clause containing the specified key.
|
protected <R,D> R |
visit (ExpVisitor<R,D> visitor,
D d) |
protected <R,D> void |
visitChildren (ExpVisitor<R,D> visitor,
D d) |
applyMethodExpression, checkLiteralKeyword, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, neverReturns, numArgs, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, side_effects, toString, validateApply, valueIfConstant apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic CaseExp(Expression key, CaseExp.CaseClause[] clauses)
public CaseExp(Expression key, CaseExp.CaseClause[] clauses, CaseExp.CaseClause elseClause)
protected boolean mustCompile()
mustCompile in class Expression public void apply(CallContext ctx) throws java.lang.Throwable
Expression apply in class Expression java.lang.Throwablepublic void print(gnu.kawa.io.OutPort out)
print in class Expression public void compile(Compilation comp, Target target)
compile in class Expression protected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
visit in class Expression protected <R,D> void visitChildren(ExpVisitor<R,D> visitor, D d)
visitChildren in class Expression protected java.lang.Object calculateDatumValue(Expression datum)
protected Type calculateType()
calculateType in class Expression protected Type calculateDatumsType()
public boolean searchValue(java.lang.Object keyValue)
public Expression selectCase(java.lang.Object keyValue)