cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
8.23k stars 1.94k forks source link

JavaScript setter syntax build output error. #16348

Open xianyinchen opened 1 year ago

xianyinchen commented 1 year ago

Cocos Creator version

3.6.3

System information

web-mobile

Issue description

set type function has logical expression

typescript code

@property({ visible: true })
set type(val: __private._cocos_ui_layout__Type) {
    super.type = val;
}
get type() {
    return super.type;
}

javascript code

_createClass(test, [{
  key: "type",
  get: function get() {
    return _Layout.prototype.type;
  },
  set: function set(val) {
    this.type = val;
  }
}]);

Relevant error log output

No response

Steps to reproduce

import { __private, _decorator,, Layout, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('test')
export class test extends Layout {
    @property(Animation)
    anim: Animation = null!;

    @property({ visible: true, serializable: false })
    set type(val: __private._cocos_ui_layout__Type) {
        super.type = val;
    }
    get type() {
        return super.type;
    }
}

Minimal reproduction project

No response

xianyinchen commented 1 year ago

@PPpro