class CheckGlobalNames extends java.lang.Object implements CompilerPass
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
private CodingConvention |
convention |
private java.util.Set<java.lang.String> |
functionPrototypeProps |
private CheckLevel |
level |
(package private) static DiagnosticType |
NAME_DEFINED_LATE_WARNING |
private GlobalNamespace |
namespace |
private java.util.Set<java.lang.String> |
objectPrototypeProps |
(package private) static DiagnosticType |
STRICT_MODULE_DEP_QNAME |
(package private) static DiagnosticType |
UNDEFINED_NAME_WARNING |
Constructor and Description |
---|
CheckGlobalNames(AbstractCompiler compiler,
CheckLevel level)
Creates a pass to check global name references at the given warning level.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkDescendantNames(GlobalNamespace.Name name,
boolean nameIsDefined)
Checks to make sure all the descendants of a name are defined if they
are referenced.
|
private void |
findPrototypeProps(java.lang.String type,
java.util.Set<java.lang.String> props) |
(package private) CheckGlobalNames |
injectNamespace(GlobalNamespace namespace)
Injects a pre-computed global namespace, so that the same namespace
can be re-used for multiple check passes.
|
private static boolean |
isTypedef(GlobalNamespace.Ref ref) |
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
private boolean |
propertyMustBeInitializedByFullName(GlobalNamespace.Name name)
The input name is a property.
|
private void |
reportBadModuleReference(GlobalNamespace.Name name,
GlobalNamespace.Ref ref) |
private void |
reportRefToUndefinedName(GlobalNamespace.Name name,
GlobalNamespace.Ref ref) |
private void |
validateName(GlobalNamespace.Name name,
boolean isDefined) |
private final AbstractCompiler compiler
private final CodingConvention convention
private final CheckLevel level
private GlobalNamespace namespace
private final java.util.Set<java.lang.String> objectPrototypeProps
private final java.util.Set<java.lang.String> functionPrototypeProps
static final DiagnosticType UNDEFINED_NAME_WARNING
static final DiagnosticType NAME_DEFINED_LATE_WARNING
static final DiagnosticType STRICT_MODULE_DEP_QNAME
CheckGlobalNames(AbstractCompiler compiler, CheckLevel level)
CheckGlobalNames injectNamespace(GlobalNamespace namespace)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprivate void findPrototypeProps(java.lang.String type, java.util.Set<java.lang.String> props)
private void checkDescendantNames(GlobalNamespace.Name name, boolean nameIsDefined)
name
- A global name.nameIsDefined
- If true, name
is defined. Otherwise, it's
undefined, and any references to descendant names should emit warnings.private void validateName(GlobalNamespace.Name name, boolean isDefined)
private static boolean isTypedef(GlobalNamespace.Ref ref)
private void reportBadModuleReference(GlobalNamespace.Name name, GlobalNamespace.Ref ref)
private void reportRefToUndefinedName(GlobalNamespace.Name name, GlobalNamespace.Ref ref)
private boolean propertyMustBeInitializedByFullName(GlobalNamespace.Name name)