|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.erights.e.elang.evm.ParseNode
|
+--org.erights.e.elang.evm.ENode
|
+--org.erights.e.elang.evm.EExpr
|
+--org.erights.e.elang.evm.CatchExpr
Safe: BNF: "try" block "catch" pattern block.
Evaluates the try-block, but should it throw a Throwable, binds pattern to the Throwable and evaluates the catch-block. The outcome of the catch expression is the outcome of the try-block, or the outcome of the catch-block if the try-block threw a Throwable.
org.erights.e.elang.evm.FinallyExpr,
org.erights.e.elang.evm.EscapeExpr| Field Summary | |
private EExpr |
myAttempt
|
private EExpr |
myCatcher
|
private Pattern |
myPattern
|
| Fields inherited from class org.erights.e.elang.evm.ENode |
|
| Fields inherited from class org.erights.e.elang.evm.ParseNode |
NUM_PR, PR_ASSIGN, PR_CALL, PR_COMP, PR_EEXPR, PR_LISTPATT, PR_ORDER, PR_PATTERN, PR_PRIM, PR_START |
| Constructor Summary | |
CatchExpr(SourceSpan optSpan,
EExpr attempt,
Pattern pattern,
EExpr catcher)
Enabled: |
|
| Method Summary | |
EExpr |
attempt()
Enabled: |
protected StaticScope |
computeStaticScope()
When staticScope() is first requested on a given node, it calls computeStaticScope() to do the actual computation, which is then remembered. |
EExpr |
katch()
Enabled: |
boolean |
matchBind(ConstList args,
Object specimen,
FlexList bindings)
Enabled: |
Pattern |
pattern()
Enabled: |
protected Object |
subEval(EvalContext ctx,
boolean forValue)
Evaluates to the outcome of the try block, but if it throws an Throwable, evaluate to the outcome of the catch block. |
void |
subPrintOn(TextWriter out,
int priority)
Enabled: |
Object |
welcome(ETreeVisitor visitor)
Enabled: |
| Methods inherited from class org.erights.e.elang.evm.EExpr |
__printOn, appendAllTo, appendTo, eval, eval, evalBool, printAsBlockOn, substitute, transform |
| Methods inherited from class org.erights.e.elang.evm.ENode |
cleanCopy, copy, getOptPatternMap, getOptScopeMap, getPatternMap, getScopeMap, qbuild, setPatternMap, setScopeMap, staticScope, synEnv |
| Methods inherited from class org.erights.e.elang.evm.ParseNode |
asText, getOptSpan, lnPrintOn, lnPrintOn, matchBind, matchBind, matchBind, printListOn, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private final EExpr myAttempt
private final Pattern myPattern
private final EExpr myCatcher
| Constructor Detail |
public CatchExpr(SourceSpan optSpan,
EExpr attempt,
Pattern pattern,
EExpr catcher)
| Method Detail |
public Object welcome(ETreeVisitor visitor)
welcome in class ENodeprotected StaticScope computeStaticScope()
ENode
computeStaticScope in class ENode
protected Object subEval(EvalContext ctx,
boolean forValue)
Subtle but important semantic point: Not only do we rethrow the original problem if the catch-pattern fails to match, we also throw the original problem if the match attempt throws, since the original problem is assumed to be a more important diagnostic than the new Throwable.
If the match attempt instead does a non-local escape, then this ejection dominates and the original problem is lost.
subEval in class EExpr
public boolean matchBind(ConstList args,
Object specimen,
FlexList bindings)
matchBind in interface MatchMakermatchBind in class ParseNodepublic EExpr attempt()
public Pattern pattern()
public EExpr katch()
public void subPrintOn(TextWriter out,
int priority)
throws IOException
subPrintOn in class ParseNodeIOException
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||