StaticOptimizer
StaticOptimizer contains a sequence of AST optimizers which are applied in order.
Expression ids and macro metadata are normalized between passes, and type-checking runs after every pass so the final output is valid and consistent with a parsed and checked expression.
Source position information is best-effort and incomplete, but optimized expressions are
suitable for calls to astToString.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StaticOptimizer(
options?):StaticOptimizer
constructor configures the optimizer from a plain option object.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”StaticOptimizer
Methods
Section titled “Methods”optimize()
Section titled “optimize()”optimize(
env,input?):AST
optimize applies the configured optimization passes to a checked AST.
Optimization and recheck failures are reported as thrown errors, matching the other high-level TypeScript environment methods.