/** Sanity checks the AST. This is by verifing the normalization passes do nothing. */ private void sanityCheckNormalization(Node externs, Node root) { // Verify nothing has inappropriately denormalize the AST. CodeChangeHandler handler = new CodeChangeHandler.ForbiddenChange(); compiler.addChangeHandler(handler); // TODO(johnlenz): Change these normalization checks Preconditions and // Exceptions into Errors so that it is easier to find the root cause // when there are cascading issues. new PrepareAst(compiler, true).process(null, root); if (compiler.isNormalized()) { (new Normalize(compiler, true)).process(externs, root); boolean checkUserDeclarations = true; CompilerPass pass = new Normalize.VerifyConstants(compiler, checkUserDeclarations); pass.process(externs, root); } compiler.removeChangeHandler(handler); }