#19232·cocos-engine

web-mobile build rewrites super accessor setter and causes infinite recursion

Author: fsd-chinaCreated Sep 22, 2026Updated Sep 22, 2026

Cocos Creator version

3.8.8

System information

Windows, web-mobile (H5) build

Issue description

A subclass accessor setter that assigns through a parent accessor with super.value = value is compiled incorrectly by the Creator 3.8.8 web-mobile build pipeline. The generated JavaScript changes the assignment target to the current instance (this.value = value), which re-enters the child setter forever and causes a stack overflow.

The repro does not depend on Cocos runtime classes:

typescript
class ProbeParent {
    private _value = 0;

    get value(): number {
        return this._value;
    }

    set value(value: number) {
        this._value = value;
    }
}

class ProbeChild extends ProbeParent {
    override get value(): number {
        return super.value;
    }

    override set value(value: number) {
        super.value = value;
    }
}

const probe = new ProbeChild();
probe.value = 7;

Steps to reproduce

  1. Create a Creator 3.8.8 project.
  2. Add the minimal TypeScript code above to a script included in the start scene.
  3. Build the project for web-mobile.
  4. Inspect the generated main bundle under assets/main/index.js.
  5. Run the H5 build.

Actual behavior

The generated bundle contains the child setter in this form:

javascript
set:function(e){this.value=e}

Executing the generated setter produces:

RangeError: Maximum call stack size exceeded

The same problem reproduces with an application class such as AudioMusic extends AudioSource when its setter contains super.volume = ....

Expected behavior

The generated code should preserve the ECMAScript semantics of a super property assignment: invoke the parent setter with the current child instance as the receiver. It must not rewrite the assignment as this.value = value.

Additional information

A workaround is to avoid assigning through a super accessor and expose a method or call the parent setter descriptor explicitly, but the original TypeScript syntax is valid and should survive the H5 transform.