Skip to content

Commit d303820

Browse files
committed
1 parent 0b1abd5 commit d303820

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*---
2+
description: Decorator order of operations and access to context name
3+
esid: pending
4+
features: [class, decorators]
5+
includes: [compareArray.js]
6+
info: |
7+
This was taken from the babel test suite https://github.com/babel/babel/blob/87ec4fc3d2cf44c30ef007f7da47d7177e07ffec/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-accessors/context-name/input.js#L1
8+
9+
---*/
10+
11+
const logs = [];
12+
const dec = (value, context) => { logs.push(context.name) };
13+
const f = () => { logs.push("computing f"); return { [Symbol.toPrimitive]: () => (logs.push("calling toPrimitive"), "f()") }; };
14+
class Foo {
15+
@dec static accessor a;
16+
@dec static accessor #a;
17+
18+
@dec static accessor "b"
19+
@dec static accessor ["c"];
20+
21+
@dec static accessor 0;
22+
@dec static accessor [1];
23+
24+
@dec static accessor 2n;
25+
@dec static accessor [3n];
26+
27+
@dec static accessor [f()];
28+
}
29+
30+
assert.compareArray(logs, ["computing f", "calling toPrimitive", "a", "#a", "b", "c", "0", "1", "2", "3", "f()"], 'order of observable operations in evaluating class definition');

0 commit comments

Comments
 (0)