Package gnu.expr

Class PushApply

  • All Implemented Interfaces:
    SourceLocator, SourceLocator, Locator

    public class PushApply
    extends ExpVisitor<Expression,​Void>
    Re-arranges ApplyExp where the function is a LetExp or BeginExp. Optimizes ((let (...) body) . args) to (let (...) (body . args)). Optimizes ((begin ... last) . args) to (begin ... (last . args)). This helps optimize Scheme "named let" (and some other forms) by making it more likely the application will be to a known procedure. Optimizes (if (let (...) body) e1 [e2]) to (let (...) (if body e1 [e2])). Optimizes (if (begin ... last) e1 [e2]) to (begin ... (if last e1 [e2])). These optimizations have to be done after Declarations are bound. Also, for each LambdaExp set the canFinishCondition field. This information is used in the following InlineCalls pass, to determine which calls (and thus other expressions) have the type neverReturnsType. That in turn is used in the later ChainLambda pass to warn about unreachable code.