mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* [static blocks] Do not inject new static fields after static code * Update fixtures * Less parentheses * Avoid temp variable * Preserve class name * Fix Babel 8 * Fix ts * fix ts again * harden new-target test * Fix old Babel 7 compat --------- Co-authored-by: Huáng Jùnliàng <[email protected]>
19 lines
593 B
JavaScript
19 lines
593 B
JavaScript
var _staticBlock, _staticBlock2;
|
|
let Foo = (class {
|
|
static #_ = _staticBlock = () => (babelHelpers.setFunctionName(this, "Foo"), (() => {
|
|
expect(this.name).toBe("Foo");
|
|
if (false) use(this);
|
|
})(), this);
|
|
}, _staticBlock());
|
|
let obj = {
|
|
["someName"]: (class {
|
|
static x = (_staticBlock2 = () => {
|
|
if (false) use(this);
|
|
expect(this.name).toBe("someName");
|
|
return this;
|
|
}, babelHelpers.setFunctionName(this, "someName"), expect(this.name).toBe("someName"));
|
|
}, _staticBlock2())
|
|
};
|
|
expect(Foo.name).toBe("Foo");
|
|
expect(obj.someName.name).toBe("someName");
|