Package com.google.javascript.jscomp
Class RewritePolyfills
java.lang.Object
com.google.javascript.jscomp.RewritePolyfills
- All Implemented Interfaces:
CompilerPass
Injects polyfill libraries to ensure that ES6+ library functions are available.
Also runs if polyfill isolation is enabled, even if polyfill injection is disabled, in order to prevent deletion of a required library function by dead code elimination.
TODO(b/120486392): consider merging this pass with InjectRuntimeLibraries and InjectTranspilationRuntimeLibraries.
-
Constructor Summary
ConstructorsConstructorDescriptionRewritePolyfills(AbstractCompiler compiler, boolean injectPolyfills, boolean isolatePolyfills, CompilerOptions.LanguageMode injectPolyfillsNewerThan) -
Method Summary
-
Constructor Details
-
RewritePolyfills
public RewritePolyfills(AbstractCompiler compiler, boolean injectPolyfills, boolean isolatePolyfills, CompilerOptions.LanguageMode injectPolyfillsNewerThan) - Parameters:
injectPolyfills- if true, injects $jscomp.polyfill initializations into the first input. if false, no polyfills are injected.isolatePolyfills- if true, adds externs for library functions used byIsolatePolyfillsto prevent their deletion.
-
-
Method Details
-
process
Description copied from interface:CompilerPassProcess the JS with root node root. Can modify the contents of each Node tree- Specified by:
processin interfaceCompilerPass- Parameters:
externs- Top of external JS treeroot- Top of JS tree
-