Package gnu.expr
Class ChainLambdas
- java.lang.Object
-
- gnu.expr.ExpVisitor<Expression,D>
-
- gnu.expr.ExpExpVisitor<ScopeExp>
-
- gnu.expr.ChainLambdas
-
- All Implemented Interfaces:
SourceLocator,SourceLocator,Locator
public class ChainLambdas extends ExpExpVisitor<ScopeExp>
Sets up the firstChild/nextSibling links of each LambdaExp. Setup 'outer' links of ScopeExp and its sub-classes. Also generates a class name for each ClassExp and registers each class. Also, if lambda is bound to a unique declaration, make that its name. This pass also checks for unreachable code, which happens if a neverReturns expression is followed dynamically by another expression. Doing this check after InlineCalls allows benefiting from data-flow; OTOH checking for unreachable code this late yields less precise type inference, but only when there actually is unreachable code, which is bogus anyway.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
-
Field Summary
-
Fields inherited from class gnu.expr.ExpVisitor
currentLambda, exitValue, messages
-
-
Constructor Summary
Constructors Constructor Description ChainLambdas()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidchainLambdas(Expression exp, Compilation comp)protected voidmaybeWarnUnreachable(Expression exp)protected ExpressionvisitApplyExp(ApplyExp exp, ScopeExp scope)protected ExpressionvisitBeginExp(BeginExp exp, ScopeExp scope)protected ExpressionvisitCaseExp(CaseExp exp, ScopeExp scope)protected ExpressionvisitClassExp(ClassExp exp, ScopeExp scope)protected ExpressionvisitIfExp(IfExp exp, ScopeExp scope)protected ExpressionvisitLambdaExp(LambdaExp exp, ScopeExp scope)protected ExpressionvisitLetExp(LetExp exp, ScopeExp scope)protected ExpressionvisitScopeExp(ScopeExp exp, ScopeExp scope)protected ExpressionvisitSetExp(SetExp sexp, ScopeExp scope)-
Methods inherited from class gnu.expr.ExpExpVisitor
defaultValue, error, error, update
-
Methods inherited from class gnu.expr.ExpVisitor
error, getColumnNumber, getCompilation, getCurrentLambda, getEndColumn, getEndLine, getExitValue, getFileName, getLanguage, getLineNumber, getMessages, getPublicId, getStartColumn, getStartLine, getSystemId, isStableSourceLocation, noteError, setColumn, setContext, setFile, setLine, setLine, visit, visit, visitAndUpdate, visitBlockExp, visitDeclarationType, visitDeclarationTypes, visitDefaultArgs, visitExitExp, visitExpression, visitExps, visitExps, visitFluidLetExp, visitLangExp, visitModuleExp, visitObjectExp, visitQuoteExp, visitReferenceExp, visitSynchronizedExp, visitThisExp, visitTryExp
-
-
-
-
Method Detail
-
chainLambdas
public static void chainLambdas(Expression exp, Compilation comp)
-
maybeWarnUnreachable
protected void maybeWarnUnreachable(Expression exp)
-
visitBeginExp
protected Expression visitBeginExp(BeginExp exp, ScopeExp scope)
- Overrides:
visitBeginExpin classExpVisitor<Expression,ScopeExp>
-
visitApplyExp
protected Expression visitApplyExp(ApplyExp exp, ScopeExp scope)
- Overrides:
visitApplyExpin classExpVisitor<Expression,ScopeExp>
-
visitSetExp
protected Expression visitSetExp(SetExp sexp, ScopeExp scope)
- Overrides:
visitSetExpin classExpVisitor<Expression,ScopeExp>
-
visitIfExp
protected Expression visitIfExp(IfExp exp, ScopeExp scope)
- Overrides:
visitIfExpin classExpVisitor<Expression,ScopeExp>
-
visitCaseExp
protected Expression visitCaseExp(CaseExp exp, ScopeExp scope)
- Overrides:
visitCaseExpin classExpVisitor<Expression,ScopeExp>
-
visitScopeExp
protected Expression visitScopeExp(ScopeExp exp, ScopeExp scope)
- Overrides:
visitScopeExpin classExpVisitor<Expression,ScopeExp>
-
visitLetExp
protected Expression visitLetExp(LetExp exp, ScopeExp scope)
- Overrides:
visitLetExpin classExpVisitor<Expression,ScopeExp>
-
visitLambdaExp
protected Expression visitLambdaExp(LambdaExp exp, ScopeExp scope)
- Overrides:
visitLambdaExpin classExpVisitor<Expression,ScopeExp>
-
visitClassExp
protected Expression visitClassExp(ClassExp exp, ScopeExp scope)
- Overrides:
visitClassExpin classExpVisitor<Expression,ScopeExp>
-
-