public final class ClosureCheckModule extends NodeTraversal.AbstractModuleCallback implements HotSwapCompilerPass
Note that this file only does checks that can be done per-file. Whole program checks happen
during goog.module rewriting, in ClosureRewriteModule
.
Modifier and Type | Field and Description |
---|---|
static DiagnosticType |
REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME |
compiler
Constructor and Description |
---|
ClosureCheckModule(AbstractCompiler compiler,
ModuleMetadataMap moduleMetadataMap) |
Modifier and Type | Method and Description |
---|---|
void |
enterModule(ModuleMetadataMap.ModuleMetadata currentModule,
Node moduleScopeRoot)
Called when the traversal enters a global file or module.
|
void |
exitModule(ModuleMetadataMap.ModuleMetadata currentModule,
Node moduleScopeRoot)
Called when the traversal exits a global file or module.
|
void |
hotSwapScript(Node scriptRoot,
Node originalRoot)
Process the JS with root node root.
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
protected void |
visit(NodeTraversal t,
Node n,
ModuleMetadataMap.ModuleMetadata currentModule,
Node moduleScopeRoot)
|
shouldTraverse, shouldTraverse, visit
public static final DiagnosticType REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME
public ClosureCheckModule(AbstractCompiler compiler, ModuleMetadataMap moduleMetadataMap)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treepublic 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 enterModule(ModuleMetadataMap.ModuleMetadata currentModule, Node moduleScopeRoot)
NodeTraversal.AbstractModuleCallback
enterModule
in class NodeTraversal.AbstractModuleCallback
currentModule
- The entered global file or module.moduleScopeRoot
- The root scope for the entered module or SCRIPT for global files.public void exitModule(ModuleMetadataMap.ModuleMetadata currentModule, Node moduleScopeRoot)
NodeTraversal.AbstractModuleCallback
exitModule
in class NodeTraversal.AbstractModuleCallback
currentModule
- The exited global file or module.moduleScopeRoot
- The root scope for the exited module or SCRIPT for global files.protected void visit(NodeTraversal t, Node n, @Nullable ModuleMetadataMap.ModuleMetadata currentModule, @Nullable Node moduleScopeRoot)
NodeTraversal.AbstractModuleCallback
visit
in class NodeTraversal.AbstractModuleCallback
t
- The current traversal.n
- The current node.currentModule
- The current module, or null if not inside a module (e.g. AST root).moduleScopeRoot
- The root scope for the current module, or null if not inside a module
(e.g. AST root).Copyright © 2009-2020 Google. All Rights Reserved.