Package com.google.javascript.jscomp
Class ClosureCheckModule
- java.lang.Object
-
- com.google.javascript.jscomp.NodeTraversal.AbstractModuleCallback
-
- com.google.javascript.jscomp.ClosureCheckModule
-
- All Implemented Interfaces:
CompilerPass
,HotSwapCompilerPass
,NodeTraversal.Callback
public final class ClosureCheckModule extends NodeTraversal.AbstractModuleCallback implements HotSwapCompilerPass
Checks that goog.module() is used correctly.Note that this file only does checks that can be done per-file. Whole program checks happen during goog.module rewriting, in
ClosureRewriteModule
.
-
-
Field Summary
Fields Modifier and Type Field Description static DiagnosticType
REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME
-
Fields inherited from class com.google.javascript.jscomp.NodeTraversal.AbstractModuleCallback
compiler
-
-
Constructor Summary
Constructors Constructor Description ClosureCheckModule(AbstractCompiler compiler, ModuleMetadataMap moduleMetadataMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Methods inherited from class com.google.javascript.jscomp.NodeTraversal.AbstractModuleCallback
shouldTraverse, shouldTraverse, visit
-
-
-
-
Field Detail
-
REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME
public static final DiagnosticType REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME
-
-
Constructor Detail
-
ClosureCheckModule
public ClosureCheckModule(AbstractCompiler compiler, ModuleMetadataMap moduleMetadataMap)
-
-
Method Detail
-
process
public void process(Node externs, Node root)
Description copied from interface:CompilerPass
Process the JS with root node root. Can modify the contents of each Node tree- Specified by:
process
in interfaceCompilerPass
- Parameters:
externs
- Top of external JS treeroot
- Top of JS tree
-
hotSwapScript
public void hotSwapScript(Node scriptRoot, Node originalRoot)
Description copied from interface:HotSwapCompilerPass
Process the JS with root node root. This is supposed to be significantly faster compared to corresponding full-compiler passes.- Specified by:
hotSwapScript
in interfaceHotSwapCompilerPass
- Parameters:
scriptRoot
- Root node corresponding to the file that is modified, should be of typeToken.SCRIPT
.originalRoot
- Root node corresponding to the original version of the file that is modified. Should be of typetoken.SCRIPT
.
-
enterModule
public void enterModule(ModuleMetadataMap.ModuleMetadata currentModule, Node moduleScopeRoot)
Description copied from class:NodeTraversal.AbstractModuleCallback
Called when the traversal enters a global file or module.- Overrides:
enterModule
in classNodeTraversal.AbstractModuleCallback
- Parameters:
currentModule
- The entered global file or module.moduleScopeRoot
- The root scope for the entered module or SCRIPT for global files.
-
exitModule
public void exitModule(ModuleMetadataMap.ModuleMetadata currentModule, Node moduleScopeRoot)
Description copied from class:NodeTraversal.AbstractModuleCallback
Called when the traversal exits a global file or module.- Overrides:
exitModule
in classNodeTraversal.AbstractModuleCallback
- Parameters:
currentModule
- The exited global file or module.moduleScopeRoot
- The root scope for the exited module or SCRIPT for global files.
-
visit
protected void visit(NodeTraversal t, Node n, @Nullable ModuleMetadataMap.ModuleMetadata currentModule, @Nullable Node moduleScopeRoot)
Description copied from class:NodeTraversal.AbstractModuleCallback
- Overrides:
visit
in classNodeTraversal.AbstractModuleCallback
- Parameters:
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).
-
-