swc_ecma_transforms_optimization::simplify::inlining

Function inlining

source
pub fn inlining(
    _: Config,
) -> impl 'static + Repeated + CompilerPass + Pass + VisitMut
Expand description

Note: this pass assumes that resolver is invoked before the pass.

As swc focuses on reducing gzipped file size, all strings are inlined.

ยงTODOs

  • Handling of void 0
  • Properly handle binary expressions.
  • Track variables access by a function

Currently all functions are treated as a black box, and all the pass gives up inlining variables across a function call or a constructor call.