You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: The order of operations is incorrect. The _initProto function should be called at the top of the constructor to ensure proper prototype initialization before any instance properties are assigned.
Our inject_after_super functionality is working as intended. However, the decorator pass executes first, leading to the following transformation:
have a solution
check if this is used in any filed initialisation, find the first one, for example value = this.getNumber()
if found: replace this with _initProto(this) (make sure _initProto returns this), so the code will become value =(_initProto(this)).getNumber()
if not found: use inject_after_super
Describe the bug
As per tc39/proposal-decorators [Adding initialization logic with addInitializer]
Method and Getter/Setter decorators should be initialised before any class fields are initialised
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.7.39&code=H4sIAAAAAAAAA3WQzwrCMAzG732KsFMLMtCrTBx48eI71C7MQtdCm%2FmXvbtdYGUHhRBIvi%2FJj5jgE8HwOqEJUVOI0IC8azfiBkzwhE9S0BzgI2Cpa911Z2%2FJamffGKUsBrak4LB2oZeVzaZK5f40p4g0Rg%2B8W0xCGKdTgpYHuZkv082muke6jMM1b1b7Rdv9EXMcV%2FC5XBl%2BMRWZwQrVdqZkKv6Hzuc8PqCV6gsyc1fOIQEAAA%3D%3D&config=H4sIAAAAAAAAA1VQQQ6DMAy78wqU8yYxJu2wP%2By6ewUBdaJNlRRpCPH3tVA6uCW2E1uei7KEjzTwLOcwhsUpFuS8B0Qm69U3IOAnh9Kwdh4uO9tiQ6w8sQSF5xEz4%2BWboBVZNgI8KysdsTl65C9vZNFko1td1fW1usP5WnGPPtIoQXBLQWAgEgxwpwZJEcBoq7vpaNOQcYwiZ2GUKtsP%2BX5zLJIrGGrHlUwVxRq2BA%2F4i3az%2FBi0vPbLtYXlByFGoz9uAQAA
SWC Info output
No response
Expected behavior
When I run output code, I should see console log
This is tsc playground link, and if I run the output code, it's as expected
Actual behavior
Wehn I run output code, I see console log
Version
1.7.39
Additional context
No response
The text was updated successfully, but these errors were encountered: