public class InlineCalls extends ExpExpVisitor<Type>
Modifier and Type | Class and Description |
---|---|
static class |
InlineCalls.LenientExpectedType
New helper Type class, used for "lenient" conversions.
|
static class |
InlineCalls.ProcedureInCallContext |
static class |
InlineCalls.ValueNeededType
A marker type to indicate that void is invalid.
|
SourceLocator.Simple
Modifier and Type | Field and Description |
---|---|
static java.lang.ThreadLocal<InlineCalls> |
currentVisitor |
currentLambda, exitValue, messages
Constructor and Description |
---|
InlineCalls(Compilation comp) |
Modifier and Type | Method and Description |
---|---|
static java.lang.Integer |
checkIntValue(Expression exp) |
static java.lang.Long |
checkLongValue(Expression exp) |
Expression |
checkType(Expression exp,
Type required) |
protected boolean |
deferableInit(Expression init) |
QuoteExp |
fixIntValue(Expression exp) |
QuoteExp |
fixLongValue(Expression exp) |
static Expression |
inlineCall(LambdaExp lexp,
ApplyExp aexp,
boolean makeCopy)
Attempt to inline a function call.
|
static Expression |
inlineCalls(Expression exp,
Compilation comp) |
static int |
isCompatibleWithValue(Type required,
Type expType) |
Expression |
maybeInline(ApplyExp exp,
Type required,
Procedure proc) |
boolean |
processingAnnotations()
If currently processing an annotation belonging to a declaration.
|
static Type |
typeForCalledFunction(Expression exp)
Return a required type for procedure application context.
|
Expression |
visit(Expression exp,
Type required)
Call the visit method of argument Expression.
|
protected void |
visitAnnotations(Declaration decl) |
protected Expression |
visitApplyExp(ApplyExp exp,
Type required) |
Expression |
visitApplyOnly(ApplyExp exp,
Type required)
Visit an ApplyExp assuming function and arguments have been visited.
|
protected Expression |
visitBeginExp(BeginExp exp,
Type required) |
protected Expression |
visitCaseExp(CaseExp exp,
Type required) |
protected Expression |
visitClassExp(ClassExp exp,
Type required) |
void |
visitDefaultArgs(LambdaExp exp,
Type required) |
protected Expression |
visitFluidLetExp(FluidLetExp exp,
Type required) |
protected Expression |
visitIfExp(IfExp exp,
Type required) |
protected Expression |
visitLambdaExp(LambdaExp exp,
Type required) |
protected Expression |
visitLetExp(LetExp exp,
Type required) |
protected Expression |
visitModuleExp(ModuleExp exp,
Type required) |
protected Expression |
visitQuoteExp(QuoteExp exp,
Type required) |
protected Expression |
visitReferenceExp(ReferenceExp exp,
Type required) |
protected void |
visitRemainingDeclaredLambdas(ScopeExp exp)
Visit any named functions that haven't been visit yet.
|
protected Expression |
visitScopeExp(ScopeExp exp,
Type required) |
protected Expression |
visitSetExp(SetExp exp,
Type required) |
protected Expression |
visitTryExp(TryExp exp,
Type required) |
defaultValue, error, error, update
error, getColumnNumber, getCompilation, getCurrentLambda, getEndColumn, getEndLine, getExitValue, getFileName, getLanguage, getLineNumber, getMessages, getPublicId, getStartColumn, getStartLine, getSystemId, isStableSourceLocation, noteError, setColumn, setContext, setFile, setLine, setLine, visit, visitAndUpdate, visitBlockExp, visitDeclarationType, visitDeclarationTypes, visitExitExp, visitExpression, visitExps, visitExps, visitLangExp, visitObjectExp, visitSynchronizedExp, visitThisExp
public static java.lang.ThreadLocal<InlineCalls> currentVisitor
public InlineCalls(Compilation comp)
public static Expression inlineCalls(Expression exp, Compilation comp)
public Expression visit(Expression exp, Type required)
ExpVisitor
visit
in class ExpVisitor<Expression,Type>
public Expression checkType(Expression exp, Type required)
protected Expression visitApplyExp(ApplyExp exp, Type required)
visitApplyExp
in class ExpVisitor<Expression,Type>
public static Type typeForCalledFunction(Expression exp)
public final Expression visitApplyOnly(ApplyExp exp, Type required)
public static java.lang.Integer checkIntValue(Expression exp)
public static java.lang.Long checkLongValue(Expression exp)
public QuoteExp fixIntValue(Expression exp)
public QuoteExp fixLongValue(Expression exp)
protected Expression visitQuoteExp(QuoteExp exp, Type required)
visitQuoteExp
in class ExpVisitor<Expression,Type>
protected Expression visitReferenceExp(ReferenceExp exp, Type required)
visitReferenceExp
in class ExpVisitor<Expression,Type>
protected Expression visitIfExp(IfExp exp, Type required)
visitIfExp
in class ExpVisitor<Expression,Type>
protected Expression visitBeginExp(BeginExp exp, Type required)
visitBeginExp
in class ExpVisitor<Expression,Type>
protected Expression visitCaseExp(CaseExp exp, Type required)
visitCaseExp
in class ExpVisitor<Expression,Type>
protected Expression visitScopeExp(ScopeExp exp, Type required)
visitScopeExp
in class ExpVisitor<Expression,Type>
protected void visitRemainingDeclaredLambdas(ScopeExp exp)
protected Expression visitModuleExp(ModuleExp exp, Type required)
visitModuleExp
in class ExpVisitor<Expression,Type>
protected Expression visitLetExp(LetExp exp, Type required)
visitLetExp
in class ExpVisitor<Expression,Type>
protected boolean deferableInit(Expression init)
protected Expression visitFluidLetExp(FluidLetExp exp, Type required)
visitFluidLetExp
in class ExpVisitor<Expression,Type>
protected Expression visitLambdaExp(LambdaExp exp, Type required)
visitLambdaExp
in class ExpVisitor<Expression,Type>
public void visitDefaultArgs(LambdaExp exp, Type required)
visitDefaultArgs
in class ExpVisitor<Expression,Type>
protected Expression visitClassExp(ClassExp exp, Type required)
visitClassExp
in class ExpVisitor<Expression,Type>
protected Expression visitTryExp(TryExp exp, Type required)
visitTryExp
in class ExpVisitor<Expression,Type>
public boolean processingAnnotations()
protected void visitAnnotations(Declaration decl)
protected Expression visitSetExp(SetExp exp, Type required)
visitSetExp
in class ExpVisitor<Expression,Type>
public Expression maybeInline(ApplyExp exp, Type required, Procedure proc)
public static Expression inlineCall(LambdaExp lexp, ApplyExp aexp, boolean makeCopy)
lexp
- function to inlinemakeCopy
- true if the body of lexp should of copied; false
if we can re-use lexp because it is no longer needed.