code: private void extractInstance(ExtractionInstance instance) {
      PrototypeMemberDeclaration first = instance.declarations.get(0);
      String className = first.qualifiedClassName;
      if (pattern == Pattern.USE_GLOBAL_TEMP) {
        // Use the temp variable to hold the prototype.
        Node classNameNode = NodeUtil.newQName(compiler, className);
        classNameNode.putBooleanProp(Node.IS_CONSTANT_NAME, first.constant);
        Node stmt =
            IR.exprResult(
                IR.assign(
                    IR.name(PROTOTYPE_ALIAS),
                    IR.getprop(
                        classNameNode, IR.string("prototype"))))
            .useSourceInfoIfMissingFromForTree(first.node);
  
        instance.parent.addChildBefore(stmt, first.node);
        compiler.reportChangeToEnclosingScope(stmt);
      } else if (pattern == Pattern.USE_IIFE) {
        Node block = IR.block();
        Node func = IR.function(
             IR.name(""),
             IR.paramList(IR.name(PROTOTYPE_ALIAS)),
             block);
  
        Node call = IR.call(func,
             NodeUtil.newQName(
                 compiler, className + ".prototype",
                 instance.parent, className + ".prototype"));
        call.putIntProp(Node.FREE_CALL, 1);
  
        Node stmt = IR.exprResult(call);
        stmt.useSourceInfoIfMissingFromForTree(first.node);
        instance.parent.addChildBefore(stmt, first.node);
        compiler.reportChangeToEnclosingScope(stmt);
        for (PrototypeMemberDeclaration declar : instance.declarations) {
          compiler.reportChangeToEnclosingScope(declar.node);
          block.addChildToBack(declar.node.detach());
        }
      }
      // Go through each member declaration and replace it with an assignment
      // to the prototype variable.
      for (PrototypeMemberDeclaration declar : instance.declarations) {
        replacePrototypeMemberDeclaration(declar);
      }
    }
docs: At a given ExtractionInstance, stores and prototype object in the temp
  variable and rewrite each member declaration to assign to the temp variable
  instead.