Package com.google.javascript.jscomp
Class AstValidator
java.lang.Object
com.google.javascript.jscomp.AstValidator
- All Implemented Interfaces:
CompilerPass
This class walks the AST and validates that the structure is correct.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceViolation handler -
Constructor Summary
ConstructorsConstructorDescriptionAstValidator(AbstractCompiler compiler) AstValidator(AbstractCompiler compiler, boolean validateScriptFeatures) AstValidator(AbstractCompiler compiler, AstValidator.ViolationHandler handler, boolean validateScriptFeatures) -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess the JS with root node root.setTypeValidationMode(com.google.javascript.jscomp.AstValidator.TypeInfoValidation mode) Enable or disable validation of type information.voidvoidvoidvoidvalidateRoot(Node n) voidvoidvoidvalidateStatement(Node n, boolean isAmbient) Validates a statement node and its children.void
-
Constructor Details
-
AstValidator
public AstValidator(AbstractCompiler compiler, AstValidator.ViolationHandler handler, boolean validateScriptFeatures) -
AstValidator
-
AstValidator
-
-
Method Details
-
setTypeValidationMode
@CanIgnoreReturnValue public AstValidator setTypeValidationMode(com.google.javascript.jscomp.AstValidator.TypeInfoValidation mode) Enable or disable validation of type information.TODO(b/74537281): Currently only expressions are checked for type information. Do we need to do more?
-
process
Description copied from interface:CompilerPassProcess the JS with root node root. Can modify the contents of each Node tree- Specified by:
processin interfaceCompilerPass- Parameters:
externs- Top of external JS treeroot- Top of JS tree
-
validateRoot
-
validateCodeRoot
-
validateScript
-
validateModuleContents
-
validateStatements
-
validateStatement
-
validateStatement
Validates a statement node and its children.- Parameters:
isAmbient- whether this statement comes from TS ambient `declare [...]`
-
validateExpression
-