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
,NodeTraversal.Callback
public final class ClosureCheckModule extends NodeTraversal.AbstractModuleCallback implements CompilerPass
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
process(Node externs, Node root)
Process the JS with root node root.protected void
visit(NodeTraversal t, Node n, @Nullable ModuleMetadataMap.ModuleMetadata currentModule, @Nullable 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
-
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).
-
-