docs: private void generateGenerator()
      {
          cfw.startMethod(codegen.getBodyMethodName(scriptOrFn),
                          codegen.getBodyMethodSignature(scriptOrFn),
                          (short)(ACC_STATIC | ACC_PRIVATE));
  
          initBodyGeneration();
          argsLocal = firstFreeLocal++;
          localsMax = firstFreeLocal;
  
          // get top level scope
          if (fnCurrent != null)
          {
              // Unless we're in a direct call use the enclosing scope
              // of the function as our variable object.
              cfw.addALoad(funObjLocal);
              cfw.addInvoke(ByteCode.INVOKEINTERFACE,
                            "org/mozilla/javascript/Scriptable",
                            "getParentScope",
                            "()Lorg/mozilla/javascript/Scriptable;");
              cfw.addAStore(variableObjectLocal);
          }
  
          // generators are forced to have an activation record
          cfw.addALoad(funObjLocal);
          cfw.addALoad(variableObjectLocal);
          cfw.addALoad(argsLocal);
          cfw.addPush(scriptOrFn.isInStrictMode());
          addScriptRuntimeInvoke("createFunctionActivation",
                                 "(Lorg/mozilla/javascript/NativeFunction;"
                                 +"Lorg/mozilla/javascript/Scriptable;"
                                 +"[Ljava/lang/Object;"
                                 +"Z"
                                 +")Lorg/mozilla/javascript/Scriptable;");
          cfw.addAStore(variableObjectLocal);
  
          // create a function object
          cfw.add(ByteCode.NEW, codegen.mainClassName);
          // Call function constructor
          cfw.add(ByteCode.DUP);
          cfw.addALoad(variableObjectLocal);
          cfw.addALoad(contextLocal);           // load 'cx'
          cfw.addPush(scriptOrFnIndex);
          cfw.addInvoke(ByteCode.INVOKESPECIAL, codegen.mainClassName,
                        "<init>", Codegen.FUNCTION_CONSTRUCTOR_SIGNATURE);
  
          generateNestedFunctionInits();
  
          // create the NativeGenerator object that we return
          cfw.addALoad(variableObjectLocal);
          cfw.addALoad(thisObjLocal);
          cfw.addLoadConstant(maxLocals);
          cfw.addLoadConstant(maxStack);
          addOptRuntimeInvoke("createNativeGenerator",
                                 "(Lorg/mozilla/javascript/NativeFunction;"
                                 +"Lorg/mozilla/javascript/Scriptable;"
                                 +"Lorg/mozilla/javascript/Scriptable;II"
                                 +")Lorg/mozilla/javascript/Scriptable;");
  
          cfw.add(ByteCode.ARETURN);
          cfw.stopMethod((short)(localsMax + 1));
      }