code: @Override
    Node optimizeSubtree(Node subtree) {
      switch (subtree.getToken()) {
        case ASSIGN:
          return tryFoldAssignment(subtree);
        case COMMA:
          return tryFoldComma(subtree);
        case SCRIPT:
        case BLOCK:
          return tryOptimizeBlock(subtree);
        case EXPR_RESULT:
          return tryFoldExpr(subtree);
        case HOOK:
          return tryFoldHook(subtree);
        case SWITCH:
          return tryOptimizeSwitch(subtree);
        case IF:
          return tryFoldIf(subtree);
        case WHILE:
          throw checkNormalization(false, "WHILE");
        case FOR:
          {
            Node condition = NodeUtil.getConditionExpression(subtree);
            if (condition != null) {
              tryFoldForCondition(condition);
            }
            return tryFoldFor(subtree);
          }
        case DO:
          Node foldedDo = tryFoldDoAway(subtree);
          if (foldedDo.isDo()) {
            return tryFoldEmptyDo(foldedDo);
          }
          return foldedDo;
  
        case TRY:
          return tryFoldTry(subtree);
        case LABEL:
          return tryFoldLabel(subtree);
        case ARRAY_PATTERN:
          return tryOptimizeArrayPattern(subtree);
        case OBJECT_PATTERN:
          return tryOptimizeObjectPattern(subtree);
        case VAR:
        case CONST:
        case LET:
          return tryOptimizeNameDeclaration(subtree);
        default:
            return subtree;
      }
    }
docs: could be changed to use code from CheckUnreachableCode to do this.