file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/static-public/output.js
JavaScript
var _init_a, _init_b, _computedKey, _init_computedKey, _initStatic; const dec = ()=>{}; _computedKey = 'c'; class Foo { static{ ({ e: [_init_a, _init_b, _init_computedKey, _initStatic] } = _apply_decs_2203_r(this, [ [ dec, 6, "a" ], [ dec, 6, "b" ], [ dec, 6, _computedKey ] ], [])); _initStatic(this); } static #___private_a_1 = _init_a(this); static get a() { return this.#___private_a_1; } static set a(_v) { this.#___private_a_1 = _v; } static #___private_b_2 = _init_b(this, 123); static get b() { return this.#___private_b_2; } static set b(_v) { this.#___private_b_2 = _v; } static #___private_computedKey_3 = _init_computedKey(this, 456); static get [_computedKey]() { return this.#___private_computedKey_3; } static set [_computedKey](_v) { this.#___private_computedKey_3 = _v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-private/input.js
JavaScript
const dec = () => {}; class Foo { accessor #a; accessor #b = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-private/output.js
JavaScript
const dec = ()=>{}; class Foo { #__a_1; get #a() { return this.#__a_1; } set #a(_v) { this.#__a_1 = _v; } #__b_2 = 123; get #b() { return this.#__b_2; } set #b(_v) { this.#__b_2 = _v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-public/input.js
JavaScript
const dec = () => {}; class Foo { accessor a; accessor b = 123; accessor ['c'] = 456; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-public/output.js
JavaScript
var _computedKey; const dec = ()=>{}; _computedKey = 'c'; class Foo { #___private_a_1; get a() { return this.#___private_a_1; } set a(_v) { this.#___private_a_1 = _v; } #___private_b_2 = 123; get b() { return this.#___private_b_2; } set b(_v) { this.#___private_b_2 = _v; } #___private_computedKey_3 = 456; get [_computedKey]() { return this.#___private_computedKey_3; } set [_computedKey](_v) { this.#___private_computedKey_3 = _v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-static-private/input.js
JavaScript
const dec = () => {}; class Foo { static accessor #a; static accessor #b = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-static-private/output.js
JavaScript
const dec = ()=>{}; class Foo { static #__a_1; static get #a() { return this.#__a_1; } static set #a(_v) { this.#__a_1 = _v; } static #__b_2 = 123; static get #b() { return this.#__b_2; } static set #b(_v) { this.#__b_2 = _v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-static-public/input.js
JavaScript
const dec = () => {}; class Foo { static accessor a; static accessor b = 123; static accessor ['c'] = 456; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-accessors/undecorated-static-public/output.js
JavaScript
var _computedKey; const dec = ()=>{}; _computedKey = 'c'; class Foo { static #___private_a_1; static get a() { return this.#___private_a_1; } static set a(_v) { this.#___private_a_1 = _v; } static #___private_b_2 = 123; static get b() { return this.#___private_b_2; } static set b(_v) { this.#___private_b_2 = _v; } static #___private_computedKey_3 = 456; static get [_computedKey]() { return this.#___private_computedKey_3; } static set [_computedKey](_v) { this.#___private_computedKey_3 = _v; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-installed-on-correct-class/exec.js
JavaScript
let hasX, hasM, OriginalFoo; class Bar {} function dec(Foo) { OriginalFoo = Foo; return Bar; } @dec class Foo { static #x; static #m() {} static x; static m() {} static { hasX = o => #x in o; hasM = o => #m in o; } } expect(hasX(Bar)).toBe(true); expect(hasM(Bar)).toBe(true); expect(hasX(OriginalFoo)).toBe(false); expect(hasM(OriginalFoo)).toBe(false); expect(Bar.hasOwnProperty("x")).toBe(true); expect(OriginalFoo.hasOwnProperty("x")).toBe(false); expect(Bar.hasOwnProperty("m")).toBe(false); expect(OriginalFoo.hasOwnProperty("m")).toBe(true);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-installed-on-correct-class/input.js
JavaScript
const dec = () => {}; let hasX, hasM; @dec class Foo { static #x; static #m() {} static x; static m() {} static { hasX = o => #x in o; hasM = o => #m in o; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-installed-on-correct-class/output.js
JavaScript
var _x, _m, _class, __; var _initClass; const dec = ()=>{}; let hasX, hasM; let _Foo; new (_x = /*#__PURE__*/ new WeakMap(), _m = /*#__PURE__*/ new WeakSet(), _class = class extends _identity { constructor(){ var _temp; _temp = super(_Foo), _class_private_method_init(this, _m), _class_private_field_init(this, _x, { writable: true, value: void 0 }), _define_property(this, "x", void 0), _temp, (()=>{ hasX = (o)=>_x.has(o); hasM = (o)=>_m.has(o); })(), _initClass(); } }, __ = { writable: true, value: (()=>{ class Foo { static m() {} } var __ = { writable: true, value: (()=>{ ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(Foo, [], [ dec ])); })() }; })() }, _class)(); function m() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-this/exec.js
JavaScript
class Bar {} let _this, _this2, _this3; @(() => Bar) class Foo { static { _this = this; } static field = (_this2 = this); static { _this3 = this; } } expect(_this).toBe(Bar); expect(_this2).toBe(Bar); expect(_this3).toBe(Bar);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-this/input.js
JavaScript
const dec = () => {}; @dec class Foo { static { this } static field = this; static { this } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/.replacement-static-this/output.js
JavaScript
var _class, __; var _initClass; const dec = ()=>{}; let _Foo; new (_class = class extends _identity { constructor(){ var _temp; _temp = super(_Foo), _define_property(this, "field", ((()=>{ this; })(), this)), _temp, (()=>{ this; })(), _initClass(); } }, __ = { writable: true, value: (()=>{ class Foo { } var __ = { writable: true, value: (()=>{ ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(Foo, [], [ dec ])); })() }; })() }, _class)();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-fields/exec.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m; return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m; } expect(value).toBe(42);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-fields/input.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).p; return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-fields/output.js
JavaScript
var _initClass, _init_m; var value; const classDec = (Class)=>{ value = (new Class).p; return Class; }; const memberDec = ()=>()=>42; let _C; class C { constructor(){ _define_property(this, "m", _init_m(this)); } } ({ e: [_init_m], c: [_C, _initClass] } = _apply_decs_2203_r(C, [ [ memberDec, 0, "m" ] ], [ classDec ])); _initClass();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-methods/exec.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m(); return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m() {}; } expect(value).toBe(42);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-methods/input.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m(); return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m() {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/decorator-access-modified-methods/output.js
JavaScript
var _initClass, _initProto; var value; const classDec = (Class)=>{ value = (new Class).m(); return Class; }; const memberDec = ()=>()=>42; let _C; class C { m() {} constructor(){ _initProto(this); } } ({ e: [_initProto], c: [_C, _initClass] } = _apply_decs_2203_r(C, [ [ memberDec, 2, "m" ] ], [ classDec ])); _initClass();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/expressions-static-blocks/input.js
JavaScript
const dec = () => {}; const A = @dec class A { static {} } const B = @dec class C { static {} } const D = @dec class { static {} } const E = (@dec class { static {} }, 123); const F = [@dec class G { static {} }, @dec class { static {} }]; const H = @dec class extends I { static {} }; const J = @dec class K extends L { static {} }; function classFactory() { return @dec class { static {} } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/expressions-static-blocks/output.js
JavaScript
var _A, _C, _class, _class1, _G, _class2, _class3, _K; var _initClass, _A1, _initClass1, _C1, _initClass2, _class4, _initClass3, _class5, _initClass4, _G1, _initClass5, _class6, _initClass6, _class7, _I, _initClass7, _K1, _L; const dec = ()=>{}; const A = ((_A = class A { }, { c: [_A1, _initClass] } = _apply_decs_2203_r(_A, [], [ dec ]), _initClass(), _A), _A1); const B = ((_C = class C { }, { c: [_C1, _initClass1] } = _apply_decs_2203_r(_C, [], [ dec ]), _initClass1(), _C), _C1); const D = ((_class = class { }, { c: [_class4, _initClass2] } = _apply_decs_2203_r(_class, [], [ dec ]), _initClass2(), _class), _class4); const E = (((_class1 = class { }, { c: [_class5, _initClass3] } = _apply_decs_2203_r(_class1, [], [ dec ]), _initClass3(), _class1), _class5), 123); const F = [ ((_G = class G { }, { c: [_G1, _initClass4] } = _apply_decs_2203_r(_G, [], [ dec ]), _initClass4(), _G), _G1), ((_class2 = class { }, { c: [_class6, _initClass5] } = _apply_decs_2203_r(_class2, [], [ dec ]), _initClass5(), _class2), _class6) ]; const H = ((_class3 = class extends (_I = I) { }, { c: [_class7, _initClass6] } = _apply_decs_2203_r(_class3, [], [ dec ], _I), _initClass6(), _class3), _class7); const J = ((_K = class K extends (_L = L) { }, { c: [_K1, _initClass7] } = _apply_decs_2203_r(_K, [], [ dec ], _L), _initClass7(), _K), _K1); function classFactory() { var _class; var _initClass, _class1; return _class = class { }, { c: [_class1, _initClass] } = _apply_decs_2203_r(_class, [], [ dec ]), _initClass(), _class, _class1; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/expressions/input.js
JavaScript
const dec = () => {}; const A = @dec class A {} const B = @dec class C {} const D = @dec class {} const E = (@dec class {}, 123); const F = [@dec class G {}, @dec class {}]; const H = @dec class extends I {}; const J = @dec class K extends L {}; function classFactory() { return @dec class {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/expressions/output.js
JavaScript
var _A, _C, _class, _class1, _G, _class2, _class3, _K; var _initClass, _A1, _initClass1, _C1, _initClass2, _class4, _initClass3, _class5, _initClass4, _G1, _initClass5, _class6, _initClass6, _class7, _I, _initClass7, _K1, _L; const dec = ()=>{}; const A = ((_A = class A { }, { c: [_A1, _initClass] } = _apply_decs_2203_r(_A, [], [ dec ]), _initClass(), _A), _A1); const B = ((_C = class C { }, { c: [_C1, _initClass1] } = _apply_decs_2203_r(_C, [], [ dec ]), _initClass1(), _C), _C1); const D = ((_class = class { }, { c: [_class4, _initClass2] } = _apply_decs_2203_r(_class, [], [ dec ]), _initClass2(), _class), _class4); const E = (((_class1 = class { }, { c: [_class5, _initClass3] } = _apply_decs_2203_r(_class1, [], [ dec ]), _initClass3(), _class1), _class5), 123); const F = [ ((_G = class G { }, { c: [_G1, _initClass4] } = _apply_decs_2203_r(_G, [], [ dec ]), _initClass4(), _G), _G1), ((_class2 = class { }, { c: [_class6, _initClass5] } = _apply_decs_2203_r(_class2, [], [ dec ]), _initClass5(), _class2), _class6) ]; const H = ((_class3 = class extends (_I = I) { }, { c: [_class7, _initClass6] } = _apply_decs_2203_r(_class3, [], [ dec ], _I), _initClass6(), _class3), _class7); const J = ((_K = class K extends (_L = L) { }, { c: [_K1, _initClass7] } = _apply_decs_2203_r(_K, [], [ dec ], _L), _initClass7(), _K), _K1); function classFactory() { var _class; var _initClass, _class1; return _class = class { }, { c: [_class1, _initClass] } = _apply_decs_2203_r(_class, [], [ dec ]), _initClass(), _class, _class1; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/inheritance/exec.js
JavaScript
let count = 0; function dec1(Klass) { expect(++count).toBe(1); expect(Klass.name).toBe('Bar'); } @dec1 class Bar {} function dec2(Klass) { expect(++count).toBe(2); expect(Klass.name).toBe('Foo'); expect(Object.getPrototypeOf(Klass)).toBe(Bar); } @dec2 class Foo extends Bar {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/inheritance/input.js
JavaScript
const dec1 = () => {}; const dec2 = () => {}; @dec1 class Bar {} @dec2 class Foo extends Bar {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/inheritance/output.js
JavaScript
var _initClass, _initClass1, _Bar; const dec1 = ()=>{}; const dec2 = ()=>{}; let _Bar1; class Bar { } ({ c: [_Bar1, _initClass] } = _apply_decs_2203_r(Bar, [], [ dec1 ])); _initClass(); let _Foo; class Foo extends (_Bar = _Bar1) { } ({ c: [_Foo, _initClass1] } = _apply_decs_2203_r(Foo, [], [ dec2 ], _Bar)); _initClass1();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/initializers/exec.js
JavaScript
function dec1(Foo, { addInitializer }) { expect(Foo.field).toBe(undefined); addInitializer(() => { Foo.initField = 123; }); } @dec1 class Foo { static { expect(this.initField).toBe(undefined); } static field = 123; } expect(Foo.initField).toBe(123); expect(Foo.field).toBe(123); function dec2(Bar, { addInitializer }) { expect(Bar.field).toBe(123); expect(Bar.otherField).toBe(undefined); expect(Bar.initField).toBe(123); addInitializer(() => { Bar.initField = 456; }); } @dec2 class Bar extends Foo { static { expect(this.initField).toBe(123); this.otherField = 456; } static field = 456; } expect(Bar.initField).toBe(456); expect(Bar.field).toBe(456); expect(Bar.otherField).toBe(456);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/initializers/input.js
JavaScript
const dec = () => {}; @dec class Foo { static field = 123; } @dec class Bar extends Foo { static { this.otherField = 456; } static field = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/initializers/output.js
JavaScript
var _class, _class1; var _initClass, _initClass1, _Foo; const dec = ()=>{}; let _Foo1; new (_class = class extends _identity { constructor(){ super(_Foo1), _initClass(); } }, (()=>{ class Foo { } ({ c: [_Foo1, _initClass] } = _apply_decs_2203_r(Foo, [], [ dec ])); _define_property(Foo, "field", 123); })(), _class)(); let _Bar; new (_class1 = class extends _identity { constructor(){ super(_Bar), _initClass1(); } }, (()=>{ var _ref; class Bar extends (_ref = _Foo = _Foo1) { } ({ c: [_Bar, _initClass1] } = _apply_decs_2203_r(Bar, [], [ dec ], _Foo)); _define_property(Bar, "field", ((()=>{ Bar.otherField = 456; })(), 123)); })(), _class1)();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement-with-expr/exec.js
JavaScript
let replaced; function dec(Klass) { replaced = class extends Klass {}; return replaced; } const Foo = @dec class Bar { static bar = new Bar(); }; const foo = new Foo(); expect(Foo).toBe(replaced); expect(Foo.bar).toBeInstanceOf(replaced); expect(foo).toBeInstanceOf(replaced);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement-with-expr/input.js
JavaScript
const dec = () => {}; const Foo = @dec class Bar { bar = new Bar(); }; const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement-with-expr/output.js
JavaScript
var _Bar; var _initClass, _Bar1; const dec = ()=>{}; const Foo = ((_Bar = class Bar { constructor(){ _define_property(this, "bar", new _Bar1()); } }, { c: [_Bar1, _initClass] } = _apply_decs_2203_r(_Bar, [], [ dec ]), _initClass(), _Bar), _Bar1); const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement/exec.js
JavaScript
let replaced; function dec(Klass) { replaced = class extends Klass {}; return replaced; } @dec class Foo { static foo = new Foo(); } const foo = new Foo(); expect(Foo).toBe(replaced); expect(Foo.foo).toBeInstanceOf(replaced); expect(foo).toBeInstanceOf(replaced);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement/input.js
JavaScript
const dec = () => {}; @dec class Foo { static foo = new Foo(); } const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes--to-es2015/replacement/output.js
JavaScript
var _class; var _initClass; const dec = ()=>{}; let _Foo; new (_class = class extends _identity { constructor(){ super(_Foo), _initClass(); } }, (()=>{ class Foo { } ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(Foo, [], [ dec ])); _define_property(Foo, "foo", new _Foo()); })(), _class)(); const foo = new _Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-fields/exec.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m; return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m; } expect(value).toBe(42);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-fields/input.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).p; return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-fields/output.js
JavaScript
var _initClass, _init_m; var value; const classDec = (Class)=>{ value = (new Class).p; return Class; }; const memberDec = ()=>()=>42; let _C; class C { static{ ({ e: [_init_m] , c: [_C, _initClass] } = _apply_decs_2203_r(this, [ [ memberDec, 0, "m" ] ], [ classDec ])); } m = _init_m(this); static{ _initClass(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-methods/exec.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m(); return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m() {}; } expect(value).toBe(42);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-methods/input.js
JavaScript
var value; const classDec = (Class) => { value = (new Class).m(); return Class }; const memberDec = () => () => 42; @classDec class C { @memberDec m() {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/decorator-access-modified-methods/output.js
JavaScript
var _initClass, _initProto; var value; const classDec = (Class)=>{ value = (new Class).m(); return Class; }; const memberDec = ()=>()=>42; let _C; class C { static{ ({ e: [_initProto] , c: [_C, _initClass] } = _apply_decs_2203_r(this, [ [ memberDec, 2, "m" ] ], [ classDec ])); } constructor(){ _initProto(this); } m() {} static{ _initClass(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/expressions-static-blocks/input.js
JavaScript
const dec = () => {}; const A = @dec class A { static {} } const B = @dec class C { static {} } const D = @dec class { static {} } const E = (@dec class { static {} }, 123); const F = [@dec class G { static {} }, @dec class { static {} }]; const H = @dec class extends I { static {} }; const J = @dec class K extends L { static {} }; function classFactory() { return @dec class { static {} } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/expressions-static-blocks/output.js
JavaScript
var _initClass, _A, _initClass1, _C, _initClass2, _class, _initClass3, _class1, _initClass4, _G, _initClass5, _class2, _initClass6, _class3, _I, _initClass7, _K, _L; const dec = ()=>{}; const A = (class A { static{ ({ c: [_A, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass(); } }, _A); const B = (class C { static{ ({ c: [_C, _initClass1] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass1(); } }, _C); const D = (class { static{ ({ c: [_class, _initClass2] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass2(); } }, _class); const E = ((class { static{ ({ c: [_class1, _initClass3] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass3(); } }, _class1), 123); const F = [ (class G { static{ ({ c: [_G, _initClass4] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass4(); } }, _G), (class { static{ ({ c: [_class2, _initClass5] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass5(); } }, _class2) ]; const H = (class extends (_I = I) { static{ ({ c: [_class3, _initClass6] } = _apply_decs_2203_r(this, [], [ dec ], _I)); } static{} static{ _initClass6(); } }, _class3); const J = (class K extends (_L = L) { static{ ({ c: [_K, _initClass7] } = _apply_decs_2203_r(this, [], [ dec ], _L)); } static{} static{ _initClass7(); } }, _K); function classFactory() { var _initClass, _class; return class { static{ ({ c: [_class, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{} static{ _initClass(); } }, _class; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/expressions/input.js
JavaScript
const dec = () => {}; const A = @dec class A {} const B = @dec class C {} const D = @dec class {} const E = (@dec class {}, 123); const F = [@dec class G {}, @dec class {}]; const H = @dec class extends I {}; const J = @dec class K extends L {}; function classFactory() { return @dec class {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/expressions/output.js
JavaScript
var _initClass, _A, _initClass1, _C, _initClass2, _class, _initClass3, _class1, _initClass4, _G, _initClass5, _class2, _initClass6, _class3, _I, _initClass7, _K, _L; const dec = ()=>{}; const A = (class A { static{ ({ c: [_A, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass(); } }, _A); const B = (class C { static{ ({ c: [_C, _initClass1] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass1(); } }, _C); const D = (class { static{ ({ c: [_class, _initClass2] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass2(); } }, _class); const E = ((class { static{ ({ c: [_class1, _initClass3] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass3(); } }, _class1), 123); const F = [ (class G { static{ ({ c: [_G, _initClass4] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass4(); } }, _G), (class { static{ ({ c: [_class2, _initClass5] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass5(); } }, _class2) ]; const H = (class extends (_I = I) { static{ ({ c: [_class3, _initClass6] } = _apply_decs_2203_r(this, [], [ dec ], _I)); } static{ _initClass6(); } }, _class3); const J = (class K extends (_L = L) { static{ ({ c: [_K, _initClass7] } = _apply_decs_2203_r(this, [], [ dec ], _L)); } static{ _initClass7(); } }, _K); function classFactory() { var _initClass, _class; return class { static{ ({ c: [_class, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass(); } }, _class; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/inheritance/input.js
JavaScript
const dec = () => {}; @dec1 class Bar {} @dec2 class Foo extends Bar {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/inheritance/output.js
JavaScript
var _initClass, _initClass1, _Bar; const dec = ()=>{}; let _Bar1; class Bar { static{ ({ c: [_Bar1, _initClass] } = _apply_decs_2203_r(this, [], [ dec1 ])); } static{ _initClass(); } } let _Foo; class Foo extends (_Bar = _Bar1) { static{ ({ c: [_Foo, _initClass1] } = _apply_decs_2203_r(this, [], [ dec2 ], _Bar)); } static{ _initClass1(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/initializers/input.js
JavaScript
const dec = () => {}; @dec class Foo { static field = 123; } @dec class Bar extends Foo { static { this.otherField = 456; } static field = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/initializers/output.js
JavaScript
var _initClass, _initClass1, _Foo; const dec = ()=>{}; let _Foo1; new class extends _identity { constructor(){ super(_Foo1), _initClass(); } static{ class Foo { static{ ({ c: [_Foo1, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static field = 123; } } }(); let _Bar; new class extends _identity { constructor(){ super(_Bar), _initClass1(); } static{ class Bar extends (_Foo = _Foo1) { static{ ({ c: [_Bar, _initClass1] } = _apply_decs_2203_r(this, [], [ dec ], _Foo)); } static field = ((()=>{ this.otherField = 456; })(), 123); } } }();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-static-installed-on-correct-class/input.js
JavaScript
const dec = () => {}; let hasX, hasM; @dec class Foo { static #x; static #m() {} static x; static m() {} static { hasX = o => #x in o; hasM = o => #m in o; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-static-installed-on-correct-class/output.js
JavaScript
var _initClass; const dec = ()=>{}; let hasX, hasM; let _Foo; new class extends _identity { constructor(){ super(_Foo), (()=>{ hasX = (o)=>#x in o; hasM = (o)=>#m in o; })(), _initClass(); } static{ class Foo { static{ ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static x; static m() {} } } #x; #m() {} }();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-static-this/input.js
JavaScript
const dec = () => {}; @dec class Foo { static { this } static field = this; static { this } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-static-this/output.js
JavaScript
var _initClass; const dec = ()=>{}; let _Foo; new class extends _identity { constructor(){ super(_Foo), (()=>{ this; })(), _initClass(); } static{ class Foo { static{ ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static field = ((()=>{ this; })(), this); } } }();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-with-expr/input.js
JavaScript
const dec = () => {}; const Foo = @dec class Bar { bar = new Bar(); }; const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement-with-expr/output.js
JavaScript
var _initClass, _Bar; const dec = ()=>{}; const Foo = (class Bar { static{ ({ c: [_Bar, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } bar = new _Bar(); static{ _initClass(); } }, _Bar); const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement/input.js
JavaScript
const dec = () => {}; @dec class Foo { static foo = new Foo(); } const foo = new Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-classes/replacement/output.js
JavaScript
var _initClass; const dec = ()=>{}; let _Foo; new class extends _identity { constructor(){ super(_Foo), _initClass(); } static{ class Foo { static{ ({ c: [_Foo, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static foo = new _Foo(); } } }(); const foo = new _Foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/.method-and-field/exec.js
JavaScript
let elements = []; function dec(val, context) { elements.push({ val, context }); } class Foo { @dec a = 123; @dec a() { return 1; } } expect(elements).toHaveLength(2); expect(elements[0].context.name).toBe("a"); expect(elements[0].val()).toBe(1); expect(elements[1].context.name).toBe("a"); expect(elements[1].val).toBe(undefined);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/.method-and-field/input.js
JavaScript
const dec = () => {}; class Foo { @dec a = 123; @dec a() { return 1; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/.method-and-field/output.js
JavaScript
var _init_a, _initProto; const dec = () => { }; class Foo { constructor() { defineProperty(this, "a", (_initProto(this), _init_a(this, 123))); } a() { return 1; } } [_init_a, _initProto] = _applyDecs2203R(Foo, [[dec, 2, "a"], [dec, 0, "a"]], []).e;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-ast/exec.js
JavaScript
var i = 0; function getKey() { return (i++).toString(); } let elements = []; function dec(fn, context) { elements.push({ fn, context }); } class Foo { @dec [getKey()]() { return 1; } @dec [getKey()]() { return 2; } } expect(elements).toHaveLength(2); expect(elements[0].context.name).toBe("0"); expect(elements[0].fn()).toBe(1); expect(elements[1].context.name).toBe("1"); expect(elements[1].fn()).toBe(2); expect(i).toBe(2);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-ast/input.js
JavaScript
const dec = () => {}; class Foo { @dec [getKey()]() { return 1; } @dec [getKey()]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-ast/output.js
JavaScript
var _computedKey, _computedKey1, _initProto; const dec = ()=>{}; _computedKey = getKey(), _computedKey1 = getKey(); let _computedKey2 = _computedKey, _computedKey3 = _computedKey1; class Foo { [_computedKey2]() { return 1; } [_computedKey3]() { return 2; } constructor(){ _initProto(this); } } ({ e: [_initProto] } = _apply_decs_2203_r(Foo, [ [ dec, 2, _computedKey ], [ dec, 2, _computedKey1 ] ], []));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-value/exec.js
JavaScript
expect(() => { var i = 0; var j = 0; function getKeyI() { return (i++).toString(); } function getKeyJ() { return (j++).toString(); } let elements = []; function dec(fn, context) { elements.push({ fn, context }); } class Foo { @dec [getKeyI()]() { return 1; } @dec [getKeyJ()]() { return 2; } } }).toThrow("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: 0")
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-value/input.js
JavaScript
const dec = () => {}; class Foo { @dec [getKeyI()]() { return 1; } @dec [getKeyJ()]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/computed-keys-same-value/output.js
JavaScript
var _computedKey, _computedKey1, _initProto; const dec = ()=>{}; _computedKey = getKeyI(), _computedKey1 = getKeyJ(); let _computedKey2 = _computedKey, _computedKey3 = _computedKey1; class Foo { [_computedKey2]() { return 1; } [_computedKey3]() { return 2; } constructor(){ _initProto(this); } } ({ e: [_initProto] } = _apply_decs_2203_r(Foo, [ [ dec, 2, _computedKey ], [ dec, 2, _computedKey1 ] ], []));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/methods-with-same-key/exec.js
JavaScript
expect(() => { let elements = []; function dec(val, context) { elements.push({ val, context }); } class Foo { @dec a() { return 1; } @dec a() { return 2; } } }).toThrow("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: a")
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/methods-with-same-key/input.js
JavaScript
const dec = () => {}; class Foo { @dec a() { return 1; } @dec a() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys--to-es2015/methods-with-same-key/output.js
JavaScript
var _initProto; const dec = ()=>{}; class Foo { a() { return 1; } a() { return 2; } constructor(){ _initProto(this); } } ({ e: [_initProto] } = _apply_decs_2203_r(Foo, [ [ dec, 2, "a" ], [ dec, 2, "a" ] ], []));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/computed-keys-same-ast/input.js
JavaScript
const dec = () => {}; class Foo { @dec [getKey()]() { return 1; } @dec [getKey()]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/computed-keys-same-ast/output.js
JavaScript
var _computedKey, _computedKey1, _initProto; const dec = ()=>{}; _computedKey = getKey(), _computedKey1 = getKey(); class Foo { static{ ({ e: [_initProto] } = _apply_decs_2203_r(this, [ [ dec, 2, _computedKey ], [ dec, 2, _computedKey1 ] ], [])); } constructor(){ _initProto(this); } [_computedKey]() { return 1; } [_computedKey1]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/computed-keys-same-value/input.js
JavaScript
const dec = () => {}; class Foo { @dec [getKeyI()]() { return 1; } @dec [getKeyJ()]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/computed-keys-same-value/output.js
JavaScript
var _computedKey, _computedKey1, _initProto; const dec = ()=>{}; _computedKey = getKeyI(), _computedKey1 = getKeyJ(); class Foo { static{ ({ e: [_initProto] } = _apply_decs_2203_r(this, [ [ dec, 2, _computedKey ], [ dec, 2, _computedKey1 ] ], [])); } constructor(){ _initProto(this); } [_computedKey]() { return 1; } [_computedKey1]() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/method-and-field/input.js
JavaScript
const dec = () => {}; class Foo { @dec a = 123; @dec a() { return 1; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/method-and-field/output.js
JavaScript
var _init_a, _initProto; const dec = ()=>{}; class Foo { static{ ({ e: [_init_a, _initProto] } = _apply_decs_2203_r(this, [ [ dec, 2, "a" ], [ dec, 0, "a" ] ], [])); } a = (_initProto(this), _init_a(this, 123)); a() { return 1; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/methods-with-same-key/input.js
JavaScript
const dec = () => {}; class Foo { @dec a() { return 1; } @dec a() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-duplicated-keys/methods-with-same-key/output.js
JavaScript
var _initProto; const dec = ()=>{}; class Foo { static{ ({ e: [_initProto] } = _apply_decs_2203_r(this, [ [ dec, 2, "a" ], [ dec, 2, "a" ] ], [])); } constructor(){ _initProto(this); } a() { return 1; } a() { return 2; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/default-anonymous/input.mjs
JavaScript
export default @dec class A {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/default-anonymous/output.mjs
JavaScript
var _initClass; let _A; class A { static{ ({ c: [_A, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass(); } } export { _A as default };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/default-named/input.mjs
JavaScript
export default @dec class {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/default-named/output.mjs
JavaScript
var _initClass; let __default; class _default { static{ ({ c: [__default, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static{ _initClass(); } } export { __default as default };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/member-decorator/input.mjs
JavaScript
export class A { @dec x; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/member-decorator/output.mjs
JavaScript
var _init_x; export class A { static{ ({ e: [_init_x] } = _apply_decs_2203_r(this, [ [ dec, 0, "x" ] ], [])); } x = _init_x(this); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/named/input.mjs
JavaScript
export @dec class A {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/named/output.mjs
JavaScript
var _initClass; let _A; class A { static { ({ c: [_A, _initClass] } = _apply_decs_2203_r(this, [], [ dec ])); } static { _initClass(); } } export { _A as A };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/no-decorators/input.mjs
JavaScript
export class A {} class B {} export { B };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-exported/no-decorators/output.mjs
JavaScript
export class A {} class B {} export { B };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/private/exec.js
JavaScript
function dec(_v, context) { return function (v) { this[context.name + 'Context'] = context; return (v || 1) + 1; } } class Foo { @dec #a; @dec #b = 123; } let foo = new Foo(); const aContext = foo['#aContext']; const bContext = foo['#bContext']; expect(aContext.access.get.call(foo)).toBe(2); aContext.access.set.call(foo, 123); expect(aContext.access.get.call(foo)).toBe(123); expect(aContext.name).toBe('#a'); expect(aContext.kind).toBe('field'); expect(aContext.static).toBe(false); expect(aContext.private).toBe(true); expect(typeof aContext.addInitializer).toBe('function'); expect(bContext.access.get.call(foo)).toBe(124); bContext.access.set.call(foo, 123); expect(bContext.access.get.call(foo)).toBe(123); expect(bContext.name).toBe('#b'); expect(bContext.kind).toBe('field'); expect(bContext.static).toBe(false); expect(bContext.private).toBe(true); expect(typeof aContext.addInitializer).toBe('function');
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/private/input.js
JavaScript
const dec = () => {}; class Foo { @dec #a; @dec #b = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/private/output.js
JavaScript
var _init_a, _init_b; const dec = ()=>{}; var _a = /*#__PURE__*/ new WeakMap(), _b = /*#__PURE__*/ new WeakMap(); class Foo { constructor(){ _class_private_field_init(this, _a, { writable: true, value: _init_a(this) }); _class_private_field_init(this, _b, { writable: true, value: _init_b(this, 123) }); } } ({ e: [_init_a, _init_b] } = _apply_decs_2203_r(Foo, [ [ dec, 0, "a", function() { return _class_private_field_get(this, _a); }, function(value) { _class_private_field_set(this, _a, value); } ], [ dec, 0, "b", function() { return _class_private_field_get(this, _b); }, function(value) { _class_private_field_set(this, _b, value); } ] ], []));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/public/exec.js
JavaScript
function dec(_v, context) { return function (v) { this[context.name + 'Context'] = context; return (v || 1) + 1; } } class Foo { @dec a; @dec b = 123; @dec ['c'] = 456; } let foo = new Foo(); const aContext = foo['aContext']; const bContext = foo['bContext']; const cContext = foo['cContext']; expect(foo.a).toBe(2); expect(aContext.access.get.call(foo)).toBe(2); foo.a = 123; expect(foo.a).toBe(123); expect(aContext.access.get.call(foo)).toBe(123); aContext.access.set.call(foo, 456); expect(foo.a).toBe(456); expect(aContext.access.get.call(foo)).toBe(456); expect(aContext.name).toBe('a'); expect(aContext.kind).toBe('field'); expect(aContext.static).toBe(false); expect(aContext.private).toBe(false); expect(typeof aContext.addInitializer).toBe('function'); expect(foo.hasOwnProperty('a')).toBe(true); expect(Foo.prototype.hasOwnProperty('a')).toBe(false); expect(foo.b).toBe(124); foo.b = 123; expect(foo.b).toBe(123); expect(bContext.name).toBe('b'); expect(bContext.kind).toBe('field'); expect(bContext.static).toBe(false); expect(bContext.private).toBe(false); expect(typeof bContext.addInitializer).toBe('function'); expect(foo.hasOwnProperty('b')).toBe(true); expect(Foo.prototype.hasOwnProperty('b')).toBe(false); expect(foo.c).toBe(457); foo.c = 456; expect(foo.c).toBe(456); expect(cContext.name).toBe('c'); expect(cContext.kind).toBe('field'); expect(cContext.static).toBe(false); expect(cContext.private).toBe(false); expect(typeof cContext.addInitializer).toBe('function'); expect(foo.hasOwnProperty('c')).toBe(true); expect(Foo.prototype.hasOwnProperty('c')).toBe(false);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/public/input.js
JavaScript
const dec = () => {}; class Foo { @dec a; @dec b = 123; @dec ['c'] = 456; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/public/output.js
JavaScript
var _computedKey, _init_a, _init_b, _init__computedKey; const dec = ()=>{}; _computedKey = 'c'; let _computedKey1 = _computedKey; class Foo { constructor(){ _define_property(this, "a", _init_a(this)); _define_property(this, "b", _init_b(this, 123)); _define_property(this, _computedKey1, _init__computedKey(this, 456)); } } ({ e: [_init_a, _init_b, _init__computedKey] } = _apply_decs_2203_r(Foo, [ [ dec, 0, "a" ], [ dec, 0, "b" ], [ dec, 0, _computedKey ] ], []));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/static-private/exec.js
JavaScript
function dec(_v, context) { return function (v) { this[context.name + 'Context'] = context; return (v || 1) + 1; } } class Foo { @dec static #a; @dec static #b = 123; } const aContext = Foo['#aContext']; const bContext = Foo['#bContext']; expect(aContext.access.get.call(Foo)).toBe(2); aContext.access.set.call(Foo, 123); expect(aContext.access.get.call(Foo)).toBe(123); expect(aContext.name).toBe('#a'); expect(aContext.kind).toBe('field'); expect(aContext.static).toBe(true); expect(aContext.private).toBe(true); expect(typeof aContext.addInitializer).toBe('function'); expect(bContext.access.get.call(Foo)).toBe(124); bContext.access.set.call(Foo, 123); expect(bContext.access.get.call(Foo)).toBe(123); expect(bContext.name).toBe('#b'); expect(bContext.kind).toBe('field'); expect(bContext.static).toBe(true); expect(bContext.private).toBe(true); expect(typeof aContext.addInitializer).toBe('function');
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/static-private/input.js
JavaScript
const dec = () => {}; class Foo { @dec static #a; @dec static #b = 123; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/static-private/output.js
JavaScript
var _init_a, _init_b; const dec = ()=>{}; class Foo { } ({ e: [_init_a, _init_b] } = _apply_decs_2203_r(Foo, [ [ dec, 5, "a", function() { return _class_static_private_field_spec_get(this, Foo, _a); }, function(value) { _class_static_private_field_spec_set(this, Foo, _a, value); } ], [ dec, 5, "b", function() { return _class_static_private_field_spec_get(this, Foo, _b); }, function(value) { _class_static_private_field_spec_set(this, Foo, _b, value); } ] ], [])); var _a = { writable: true, value: _init_a(Foo) }; var _b = { writable: true, value: _init_b(Foo, 123) };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/static-public/exec.js
JavaScript
function dec(_v, context) { return function (v) { this[context.name + 'Context'] = context; return (v || 1) + 1; } } class Foo { @dec static a; @dec static b = 123; @dec static ['c'] = 456; } const aContext = Foo['aContext']; const bContext = Foo['bContext']; const cContext = Foo['cContext']; expect(Foo.a).toBe(2); expect(aContext.access.get.call(Foo)).toBe(2); Foo.a = 123; expect(Foo.a).toBe(123); expect(aContext.access.get.call(Foo)).toBe(123); aContext.access.set.call(Foo, 456); expect(Foo.a).toBe(456); expect(aContext.access.get.call(Foo)).toBe(456); expect(aContext.name).toBe('a'); expect(aContext.kind).toBe('field'); expect(aContext.static).toBe(true); expect(aContext.private).toBe(false); expect(typeof aContext.addInitializer).toBe('function'); expect(Foo.hasOwnProperty('a')).toBe(true); expect(Foo.b).toBe(124); Foo.b = 123; expect(Foo.b).toBe(123); expect(bContext.name).toBe('b'); expect(bContext.kind).toBe('field'); expect(bContext.static).toBe(true); expect(bContext.private).toBe(false); expect(typeof bContext.addInitializer).toBe('function'); expect(Foo.hasOwnProperty('b')).toBe(true); expect(Foo.c).toBe(457); Foo.c = 456; expect(Foo.c).toBe(456); expect(cContext.name).toBe('c'); expect(cContext.kind).toBe('field'); expect(cContext.static).toBe(true); expect(cContext.private).toBe(false); expect(typeof cContext.addInitializer).toBe('function'); expect(Foo.hasOwnProperty('c')).toBe(true);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields--to-es2015/static-public/input.js
JavaScript
const dec = () => {}; class Foo { @dec static a; @dec static b = 123; @dec static ['c'] = 456; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University