static NativeGenerator init(ScriptableObject scope, boolean sealed) {
    // Generator
    // Can't use "NativeGenerator().exportAsJSClass" since we don't want
    // to define "Generator" as a constructor in the top-level scope.

    NativeGenerator prototype = new NativeGenerator();
    if (scope != null) {
      prototype.setParentScope(scope);
      prototype.setPrototype(getObjectPrototype(scope));
    }
    prototype.activatePrototypeMap(MAX_PROTOTYPE_ID);
    if (sealed) {
      prototype.sealObject();
    }

    // Need to access Generator prototype when constructing
    // Generator instances, but don't have a generator constructor
    // to use to find the prototype. Use the "associateValue"
    // approach instead.
    if (scope != null) {
      scope.associateValue(GENERATOR_TAG, prototype);
    }

    return prototype;
  }