-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Spec: DecoratorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
const dummy = () => {}
const logs = [];
@dummy
class C {
[(logs.push(1), 1)];
static [(logs.push(2), 2)];
[(logs.push(3), 3)];
}
console.log(logs);Configuration file name
No response
Configuration
{
"plugins": [
["proposal-decorators", { "version": "2023-11" }]
]
}
Current and expected behavior
7.24.0: it prints [2, 1, 3]
main: it prints [1, 3, 2]
expected: it should print [1, 2, 3]
Environment
REPL
Possible solution
No response
Additional context
As a workaround, you can add a dummy decorator to any class elements, then the evaluation order will be correct.
For example,
const dummy = () => {}
const logs = [];
@dummy
class C {
@dummy
[(logs.push(1), 1)];
static [(logs.push(2), 2)];
[(logs.push(3), 3)];
}
console.log(logs);Metadata
Metadata
Assignees
Labels
Spec: DecoratorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue