Optimization Passes

Script optimization is performed via multiple passes. Each pass does a specific optimization.

The optimization is completed when no passes can simplify the AST any further.

Built-in Optimization Passes

Dead code eliminationEliminates code that cannot be reached
Constants propagationReplaces constants with values
Compound assignments rewriteRewrites assignments into compound assignments
Eager operator evaluationEagerly calls operators with constant arguments
Eager function evaluationEagerly calls functions with constant arguments