public class RewritePolyfills extends java.lang.Object implements HotSwapCompilerPass
var m = new Map();
becomes
$jscomp.Map$install(); var m = new $jscomp.Map();
Modifier and Type | Class and Description |
---|---|
private static class |
RewritePolyfills.InjectedInstaller |
private static class |
RewritePolyfills.Polyfill
Represents a single polyfill: specifically, a native symbol
(either a qualified name or a property name) that can be
rewritten and/or installed to provide the functionality to
a lower version.
|
(package private) static class |
RewritePolyfills.Polyfills
Describes all the available polyfills, including native and
required versions, and how to use them.
|
private class |
RewritePolyfills.Traverser |
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
private static java.lang.String |
GLOBAL |
private GlobalNamespace |
globals |
(package private) static DiagnosticType |
INSUFFICIENT_OUTPUT_VERSION_ERROR |
private RewritePolyfills.Polyfills |
polyfills |
private static RewritePolyfills.Polyfills |
POLYFILLS |
private static java.lang.String |
WINDOW |
Constructor and Description |
---|
RewritePolyfills(AbstractCompiler compiler) |
RewritePolyfills(AbstractCompiler compiler,
RewritePolyfills.Polyfills polyfills) |
Modifier and Type | Method and Description |
---|---|
void |
hotSwapScript(Node scriptRoot,
Node originalRoot)
Process the JS with root node root.
|
private static boolean |
isRootInScope(Node node,
NodeTraversal traversal) |
private boolean |
languageOutIsAtLeast(CompilerOptions.LanguageMode mode) |
private boolean |
languageOutIsAtLeast(FeatureSet features) |
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
static final DiagnosticType INSUFFICIENT_OUTPUT_VERSION_ERROR
private static final java.lang.String GLOBAL
private static final java.lang.String WINDOW
private static final RewritePolyfills.Polyfills POLYFILLS
private final AbstractCompiler compiler
private final RewritePolyfills.Polyfills polyfills
private GlobalNamespace globals
public RewritePolyfills(AbstractCompiler compiler)
RewritePolyfills(AbstractCompiler compiler, RewritePolyfills.Polyfills polyfills)
public void hotSwapScript(Node scriptRoot, Node originalRoot)
HotSwapCompilerPass
hotSwapScript
in interface HotSwapCompilerPass
scriptRoot
- Root node corresponding to the file that is modified,
should be of type Token.SCRIPT
.originalRoot
- Root node corresponding to the original version of the
file that is modified. Should be of type token.SCRIPT
.public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprivate boolean languageOutIsAtLeast(CompilerOptions.LanguageMode mode)
private boolean languageOutIsAtLeast(FeatureSet features)
private static boolean isRootInScope(Node node, NodeTraversal traversal)