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 void
chainLambdas(Expression exp, Compilation comp)
protected void
maybeWarnUnreachable(Expression exp)
protected Expression
visitApplyExp(ApplyExp exp, ScopeExp scope)
protected Expression
visitBeginExp(BeginExp exp, ScopeExp scope)
protected Expression
visitCaseExp(CaseExp exp, ScopeExp scope)
protected Expression
visitClassExp(ClassExp exp, ScopeExp scope)
protected Expression
visitIfExp(IfExp exp, ScopeExp scope)
protected Expression
visitLambdaExp(LambdaExp exp, ScopeExp scope)
protected Expression
visitLetExp(LetExp exp, ScopeExp scope)
protected Expression
visitScopeExp(ScopeExp exp, ScopeExp scope)
protected Expression
visitSetExp(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:
visitBeginExp
in classExpVisitor<Expression,ScopeExp>
-
visitApplyExp
protected Expression visitApplyExp(ApplyExp exp, ScopeExp scope)
- Overrides:
visitApplyExp
in classExpVisitor<Expression,ScopeExp>
-
visitSetExp
protected Expression visitSetExp(SetExp sexp, ScopeExp scope)
- Overrides:
visitSetExp
in classExpVisitor<Expression,ScopeExp>
-
visitIfExp
protected Expression visitIfExp(IfExp exp, ScopeExp scope)
- Overrides:
visitIfExp
in classExpVisitor<Expression,ScopeExp>
-
visitCaseExp
protected Expression visitCaseExp(CaseExp exp, ScopeExp scope)
- Overrides:
visitCaseExp
in classExpVisitor<Expression,ScopeExp>
-
visitScopeExp
protected Expression visitScopeExp(ScopeExp exp, ScopeExp scope)
- Overrides:
visitScopeExp
in classExpVisitor<Expression,ScopeExp>
-
visitLetExp
protected Expression visitLetExp(LetExp exp, ScopeExp scope)
- Overrides:
visitLetExp
in classExpVisitor<Expression,ScopeExp>
-
visitLambdaExp
protected Expression visitLambdaExp(LambdaExp exp, ScopeExp scope)
- Overrides:
visitLambdaExp
in classExpVisitor<Expression,ScopeExp>
-
visitClassExp
protected Expression visitClassExp(ClassExp exp, ScopeExp scope)
- Overrides:
visitClassExp
in classExpVisitor<Expression,ScopeExp>
-
-