src/com/google/javascript/jscomp/Es6RewriteClassExtendsExpressions.java
/**
   * When a class is used in an expressions where adding an alias as the previous statement might
   * change execution order of a side-effect causing statement, wrap the class in an IIFE so that
   * decomposition can happen safely.
   */
When a class is used in an expressions where adding an alias as the previous statement might
change execution order of a side-effect causing statement, wrap the class in an IIFE so that
decomposition can happen safely.
When a class is used in an expressions where adding an alias as the previous statement might change execution order of a side - effect causing statement wrap the class in an IIFE so that decomposition can happen safely .
private void decomposeInIIFE(NodeTraversal t, Node classNode) {
    Node functionBody = IR.block();
    Node function = IR.function(IR.name(""), IR.paramList(), functionBody);
    Node call = NodeUtil.newCallNode(function);
    classNode.replaceWith(call);
    functionBody.addChildToBack(IR.returnNode(classNode));
    call.useSourceInfoIfMissingFromForTree(classNode);
    t.reportCodeChange(call);
    extractExtends(t, classNode);
  }
private void decomposeInIIFE ( NodeTraversal t , Node classNode ) { Node functionBody = IR . block ( ) ; Node function = IR . function ( IR . name ( "" ) , IR . paramList ( ) , functionBody ) ; Node call = NodeUtil . newCallNode ( function ) ; classNode . replaceWith ( call ) ; functionBody . addChildToBack ( IR . returnNode ( classNode ) ) ; call . useSourceInfoIfMissingFromForTree ( classNode ) ; t . reportCodeChange ( call ) ; extractExtends ( t , classNode ) ; }
When a class is used in an expressions where adding an alias as the previous statement might
 change execution order of a side-effect causing statement, wrap the class in an IIFE so that
 decomposition can happen safely.
When a class is used in an expressions where adding an alias as the previous statement might change execution order of a side - effect causing statement wrap the class in an IIFE so that decomposition can happen safely .
// converts // `class X extends something {}` // to // `(function() { return class X extends something {}; })()` // NOTE: extractExtends() will end up reporting the change for the new function, so we only //     need to report the change to the enclosing scope // Now do the extends expression extraction within the IIFE