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-fields--to-es2015/static-public/output.js | JavaScript | var _computedKey, _init_a, _init_b, _init__computedKey;
const dec = ()=>{};
_computedKey = 'c';
class Foo {
}
({ e: [_init_a, _init_b, _init__computedKey] } = _apply_decs_2203_r(Foo, [
[
dec,
5,
"a"
],
[
dec,
5,
"b"
],
[
dec,
5,
_computedKey
]
], []));
_define_property(Foo, "a", _init_a(Foo));
_define_property(Foo, "b", _init_b(Foo, 123));
_define_property(Foo, _computedKey, _init__computedKey(Foo, 456));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields/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/private/output.js | JavaScript | var _init_a, _init_b;
const dec = ()=>{};
class Foo {
static{
({ e: [_init_a, _init_b] } = _apply_decs_2203_r(this, [
[
dec,
0,
"a",
function() {
return this.#a;
},
function(value) {
this.#a = value;
}
],
[
dec,
0,
"b",
function() {
return this.#b;
},
function(value) {
this.#b = value;
}
]
], []));
}
#a = _init_a(this);
#b = _init_b(this, 123);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields/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/public/output.js | JavaScript | var _computedKey, _init_a, _init_b, _init__computedKey;
const dec = ()=>{};
_computedKey = 'c';
class Foo {
static{
({ e: [_init_a, _init_b, _init__computedKey] } = _apply_decs_2203_r(this, [
[
dec,
0,
"a"
],
[
dec,
0,
"b"
],
[
dec,
0,
_computedKey
]
], []));
}
a = _init_a(this);
b = _init_b(this, 123);
[_computedKey] = _init__computedKey(this, 456);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields/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/static-private/output.js | JavaScript | var _init_a, _init_b;
const dec = ()=>{};
class Foo {
static{
({ e: [_init_a, _init_b] } = _apply_decs_2203_r(this, [
[
dec,
5,
"a",
function() {
return this.#a;
},
function(value) {
this.#a = value;
}
],
[
dec,
5,
"b",
function() {
return this.#b;
},
function(value) {
this.#b = value;
}
]
], []));
}
static #a = _init_a(this);
static #b = _init_b(this, 123);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields/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 | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-fields/static-public/output.js | JavaScript | var _computedKey, _init_a, _init_b, _init__computedKey;
const dec = ()=>{};
_computedKey = 'c';
class Foo {
static{
({ e: [_init_a, _init_b, _init__computedKey] } = _apply_decs_2203_r(this, [
[
dec,
5,
"a"
],
[
dec,
5,
"b"
],
[
dec,
5,
_computedKey
]
], []));
}
static a = _init_a(this);
static b = _init_b(this, 123);
static [_computedKey] = _init__computedKey(this, 456);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/private/exec.js | JavaScript | function dec(get, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return get.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
getA() {
return this.#a;
}
}
let foo = new Foo();
const aContext = foo['#aContext'];
expect(aContext.access.get.call(foo)).toBe(2);
expect(foo.getA()).toBe(2);
foo.value = 123;
expect(aContext.access.get.call(foo)).toBe(124);
expect(foo.getA()).toBe(124);
expect(aContext.name).toBe('#a');
expect(aContext.kind).toBe('getter');
expect(aContext.static).toBe(false);
expect(aContext.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-getters--to-es2015/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/private/output.js | JavaScript | var _call_a, _initProto;
const dec = ()=>{};
var _a = /*#__PURE__*/ new WeakMap();
class Foo {
getA() {
return _class_private_field_get(this, _a);
}
constructor(){
_class_private_field_init(this, _a, {
get: get_a,
set: void 0
});
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_call_a, _initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
3,
"a",
function() {
return this.value;
}
]
], []));
function get_a() {
return _call_a(this);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/public/exec.js | JavaScript | function dec(get, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return get.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
get ['b']() {
return this.value;
}
}
let foo = new Foo();
const aContext = foo['aContext'];
const bContext = foo['bContext'];
expect(foo.a).toBe(2);
expect(foo.b).toBe(2);
expect(aContext.access.get.call(foo)).toBe(2);
expect(bContext.access.get.call(foo)).toBe(2);
foo.value = 123;
expect(foo.a).toBe(124);
expect(foo.b).toBe(124);
expect(aContext.access.get.call(foo)).toBe(124);
expect(bContext.access.get.call(foo)).toBe(124);
expect(aContext.name).toBe('a');
expect(aContext.kind).toBe('getter');
expect(aContext.static).toBe(false);
expect(aContext.private).toBe(false);
expect(typeof aContext.addInitializer).toBe('function');
expect(bContext.name).toBe('b');
expect(bContext.kind).toBe('getter');
expect(bContext.static).toBe(false);
expect(bContext.private).toBe(false);
expect(typeof bContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
get ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/public/output.js | JavaScript | var _computedKey, _initProto;
const dec = ()=>{};
_computedKey = 'b';
let _computedKey1 = _computedKey;
class Foo {
get a() {
return this.value;
}
get [_computedKey1]() {
return this.value;
}
constructor(){
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
3,
"a"
],
[
dec,
3,
_computedKey
]
], []));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/static-private/exec.js | JavaScript | function dec(get, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return get.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
static getA() {
return this.#a;
}
}
const aContext = Foo['#aContext'];
expect(aContext.access.get.call(Foo)).toBe(2);
expect(Foo.getA()).toBe(2);
Foo.value = 123;
expect(aContext.access.get.call(Foo)).toBe(124);
expect(Foo.getA()).toBe(124);
expect(aContext.name).toBe('#a');
expect(aContext.kind).toBe('getter');
expect(aContext.static).toBe(true);
expect(aContext.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-getters--to-es2015/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
static getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/static-private/output.js | JavaScript | var _call_a, _initStatic;
const dec = ()=>{};
class Foo {
static getA() {
return _class_static_private_field_spec_get(this, Foo, _a);
}
}
var _a = {
get: get_a,
set: void 0
};
(()=>{
({ e: [_call_a, _initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
8,
"a",
function() {
return this.value;
}
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
function get_a() {
return _call_a(this);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/static-public/exec.js | JavaScript | function dec(get, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return get.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static get ['b']() {
return this.value;
}
}
const aContext = Foo['aContext'];
const bContext = Foo['bContext'];
expect(Foo.a).toBe(2);
expect(Foo.b).toBe(2);
expect(aContext.access.get.call(Foo)).toBe(2);
expect(bContext.access.get.call(Foo)).toBe(2);
Foo.value = 123;
expect(Foo.a).toBe(124);
expect(Foo.b).toBe(124);
expect(aContext.access.get.call(Foo)).toBe(124);
expect(bContext.access.get.call(Foo)).toBe(124);
expect(aContext.name).toBe('a');
expect(aContext.kind).toBe('getter');
expect(aContext.static).toBe(true);
expect(aContext.private).toBe(false);
expect(typeof aContext.addInitializer).toBe('function');
expect(bContext.name).toBe('b');
expect(bContext.kind).toBe('getter');
expect(bContext.static).toBe(true);
expect(bContext.private).toBe(false);
expect(typeof bContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static get ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters--to-es2015/static-public/output.js | JavaScript | var _computedKey, _initStatic;
const dec = ()=>{};
_computedKey = 'b';
let _computedKey1 = _computedKey;
class Foo {
static get a() {
return this.value;
}
static get [_computedKey1]() {
return this.value;
}
}
(()=>{
({ e: [_initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
8,
"a"
],
[
dec,
8,
_computedKey
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/private/exec.js | JavaScript | function dec(value, context) {
context.addInitializer(function() {
this[context.name + '_' + context.kind + 'Context'] = context;
});
if (context.kind === 'getter') {
return function () {
return value.call(this) + 1;
}
} else {
return function (v) {
return value.call(this, v + 1);
}
}
}
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
@dec
set #a(v) {
this.value = v;
}
getA() {
return this.#a;
}
setA(v) {
this.#a = v;
}
}
let foo = new Foo();
const a_getterContext = foo['#a_getterContext'];
const a_setterContext = foo['#a_setterContext'];
expect(a_getterContext.access.get.call(foo)).toBe(2);
expect(foo.getA()).toBe(2);
a_setterContext.access.set.call(foo, 123);
expect(a_getterContext.access.get.call(foo)).toBe(125);
expect(foo.getA()).toBe(125);
foo.setA(456);
expect(a_getterContext.access.get.call(foo)).toBe(458);
expect(foo.getA()).toBe(458);
expect(a_getterContext.name).toBe('#a');
expect(a_getterContext.kind).toBe('getter');
expect(a_getterContext.static).toBe(false);
expect(a_getterContext.private).toBe(true);
expect(typeof a_getterContext.addInitializer).toBe('function');
expect(a_setterContext.name).toBe('#a');
expect(a_setterContext.kind).toBe('setter');
expect(a_setterContext.static).toBe(false);
expect(a_setterContext.private).toBe(true);
expect(typeof a_setterContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
@dec
set #a(v) {
this.value = v;
}
getA() {
return this.#a;
}
setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/private/output.js | JavaScript | var _call_a, _call_a1, _initProto;
const dec = ()=>{};
var _a = /*#__PURE__*/ new WeakMap();
class Foo {
getA() {
return _class_private_field_get(this, _a);
}
setA(v) {
_class_private_field_set(this, _a, v);
}
constructor(){
_class_private_field_init(this, _a, {
get: get_a,
set: set_a
});
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_call_a, _call_a1, _initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
3,
"a",
function() {
return this.value;
}
],
[
dec,
4,
"a",
function(v) {
this.value = v;
}
]
], []));
function get_a() {
return _call_a(this);
}
function set_a(v) {
return _call_a1(this, v);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/public/exec.js | JavaScript | function dec(value, context) {
context.addInitializer(function() {
this[context.name + '_' + context.kind + 'Context'] = context;
});
if (context.kind === 'getter') {
return function () {
return value.call(this) + 1;
}
} else {
return function (v) {
return value.call(this, v + 1);
}
}
}
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
set a(v) {
this.value = v;
}
@dec
get ['b']() {
return this.value;
}
@dec
set ['b'](v) {
this.value = v;
}
}
let foo = new Foo();
const a_getterContext = foo['a_getterContext'];
const a_setterContext = foo['a_setterContext'];
const b_getterContext = foo['b_getterContext'];
const b_setterContext = foo['b_setterContext'];
expect(foo.a).toBe(2);
expect(foo.b).toBe(2);
expect(a_getterContext.access.get.call(foo)).toBe(2);
expect(b_getterContext.access.get.call(foo)).toBe(2);
foo.a = 123;
expect(foo.a).toBe(125);
expect(foo.b).toBe(125);
expect(a_getterContext.access.get.call(foo)).toBe(125);
expect(b_getterContext.access.get.call(foo)).toBe(125);
foo.b = 456;
expect(foo.a).toBe(458);
expect(foo.b).toBe(458);
expect(a_getterContext.access.get.call(foo)).toBe(458);
expect(b_getterContext.access.get.call(foo)).toBe(458);
a_setterContext.access.set.call(foo, 789);
expect(foo.a).toBe(791);
expect(foo.b).toBe(791);
expect(a_getterContext.access.get.call(foo)).toBe(791);
expect(b_getterContext.access.get.call(foo)).toBe(791);
expect(a_getterContext.name).toBe('a');
expect(a_getterContext.kind).toBe('getter');
expect(a_getterContext.static).toBe(false);
expect(a_getterContext.private).toBe(false);
expect(typeof a_getterContext.addInitializer).toBe('function');
expect(a_setterContext.name).toBe('a');
expect(a_setterContext.kind).toBe('setter');
expect(a_setterContext.static).toBe(false);
expect(a_setterContext.private).toBe(false);
expect(typeof a_setterContext.addInitializer).toBe('function');
expect(b_getterContext.name).toBe('b');
expect(b_getterContext.kind).toBe('getter');
expect(b_getterContext.static).toBe(false);
expect(b_getterContext.private).toBe(false);
expect(typeof b_getterContext.addInitializer).toBe('function');
expect(b_setterContext.name).toBe('b');
expect(b_setterContext.kind).toBe('setter');
expect(b_setterContext.static).toBe(false);
expect(b_setterContext.private).toBe(false);
expect(typeof b_setterContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
set a(v) {
this.value = v;
}
@dec
get ['b']() {
return this.value;
}
@dec
set ['b'](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/public/output.js | JavaScript | var _computedKey, _computedKey1, _initProto;
const dec = ()=>{};
_computedKey = 'b', _computedKey1 = 'b';
let _computedKey2 = _computedKey, _computedKey3 = _computedKey1;
class Foo {
get a() {
return this.value;
}
set a(v) {
this.value = v;
}
get [_computedKey2]() {
return this.value;
}
set [_computedKey3](v) {
this.value = v;
}
constructor(){
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
3,
"a"
],
[
dec,
4,
"a"
],
[
dec,
3,
_computedKey
],
[
dec,
4,
_computedKey1
]
], []));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-private/exec.js | JavaScript | function dec(value, context) {
context.addInitializer(function() {
this[context.name + '_' + context.kind + 'Context'] = context;
});
if (context.kind === 'getter') {
return function () {
return value.call(this) + 1;
}
} else {
return function (v) {
return value.call(this, v + 1);
}
}
}
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
@dec
static set #a(v) {
this.value = v;
}
static getA() {
return this.#a;
}
static setA(v) {
this.#a = v;
}
}
const a_getterContext = Foo['#a_getterContext'];
const a_setterContext = Foo['#a_setterContext'];
expect(a_getterContext.access.get.call(Foo)).toBe(2);
expect(Foo.getA()).toBe(2);
a_setterContext.access.set.call(Foo, 123);
expect(a_getterContext.access.get.call(Foo)).toBe(125);
expect(Foo.getA()).toBe(125);
Foo.setA(456);
expect(a_getterContext.access.get.call(Foo)).toBe(458);
expect(Foo.getA()).toBe(458);
expect(a_getterContext.name).toBe('#a');
expect(a_getterContext.kind).toBe('getter');
expect(a_getterContext.static).toBe(true);
expect(a_getterContext.private).toBe(true);
expect(typeof a_getterContext.addInitializer).toBe('function');
expect(a_setterContext.name).toBe('#a');
expect(a_setterContext.kind).toBe('setter');
expect(a_setterContext.static).toBe(true);
expect(a_setterContext.private).toBe(true);
expect(typeof a_setterContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
@dec
static set #a(v) {
this.value = v;
}
static getA() {
return this.#a;
}
static setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-private/output.js | JavaScript | var _call_a, _call_a1, _initStatic;
const dec = ()=>{};
class Foo {
static getA() {
return _class_static_private_field_spec_get(this, Foo, _a);
}
static setA(v) {
_class_static_private_field_spec_set(this, Foo, _a, v);
}
}
var _a = {
get: get_a,
set: set_a
};
(()=>{
({ e: [_call_a, _call_a1, _initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
8,
"a",
function() {
return this.value;
}
],
[
dec,
9,
"a",
function(v) {
this.value = v;
}
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
function get_a() {
return _call_a(this);
}
function set_a(v) {
return _call_a1(this, v);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-public/exec.js | JavaScript | function dec(value, context) {
context.addInitializer(function() {
this[context.name + '_' + context.kind + 'Context'] = context;
});
if (context.kind === 'getter') {
return function () {
return value.call(this) + 1;
}
} else {
return function (v) {
return value.call(this, v + 1);
}
}
}
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static set a(v) {
this.value = v;
}
@dec
static get ['b']() {
return this.value;
}
@dec
static set ['b'](v) {
this.value = v;
}
}
const a_getterContext = Foo['a_getterContext'];
const a_setterContext = Foo['a_setterContext'];
const b_getterContext = Foo['b_getterContext'];
const b_setterContext = Foo['b_setterContext'];
expect(Foo.a).toBe(2);
expect(Foo.b).toBe(2);
expect(a_getterContext.access.get.call(Foo)).toBe(2);
expect(b_getterContext.access.get.call(Foo)).toBe(2);
Foo.a = 123;
expect(Foo.a).toBe(125);
expect(Foo.b).toBe(125);
expect(a_getterContext.access.get.call(Foo)).toBe(125);
expect(b_getterContext.access.get.call(Foo)).toBe(125);
Foo.b = 456;
expect(Foo.a).toBe(458);
expect(Foo.b).toBe(458);
expect(a_getterContext.access.get.call(Foo)).toBe(458);
expect(b_getterContext.access.get.call(Foo)).toBe(458);
a_setterContext.access.set.call(Foo, 789);
expect(Foo.a).toBe(791);
expect(Foo.b).toBe(791);
expect(a_getterContext.access.get.call(Foo)).toBe(791);
expect(b_getterContext.access.get.call(Foo)).toBe(791);
expect(a_getterContext.name).toBe('a');
expect(a_getterContext.kind).toBe('getter');
expect(a_getterContext.static).toBe(true);
expect(a_getterContext.private).toBe(false);
expect(typeof a_getterContext.addInitializer).toBe('function');
expect(a_setterContext.name).toBe('a');
expect(a_setterContext.kind).toBe('setter');
expect(a_setterContext.static).toBe(true);
expect(a_setterContext.private).toBe(false);
expect(typeof a_setterContext.addInitializer).toBe('function');
expect(b_getterContext.name).toBe('b');
expect(b_getterContext.kind).toBe('getter');
expect(b_getterContext.static).toBe(true);
expect(b_getterContext.private).toBe(false);
expect(typeof b_getterContext.addInitializer).toBe('function');
expect(b_setterContext.name).toBe('b');
expect(b_setterContext.kind).toBe('setter');
expect(b_setterContext.static).toBe(true);
expect(b_setterContext.private).toBe(false);
expect(typeof b_setterContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static set a(v) {
this.value = v;
}
@dec
static get ['b']() {
return this.value;
}
@dec
static set ['b'](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters--to-es2015/static-public/output.js | JavaScript | var _computedKey, _computedKey1, _initStatic;
const dec = ()=>{};
_computedKey = 'b', _computedKey1 = 'b';
let _computedKey2 = _computedKey, _computedKey3 = _computedKey1;
class Foo {
static get a() {
return this.value;
}
static set a(v) {
this.value = v;
}
static get [_computedKey2]() {
return this.value;
}
static set [_computedKey3](v) {
this.value = v;
}
}
(()=>{
({ e: [_initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
8,
"a"
],
[
dec,
9,
"a"
],
[
dec,
8,
_computedKey
],
[
dec,
9,
_computedKey1
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
@dec
set #a(v) {
this.value = v;
}
getA() {
return this.#a;
}
setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/private/output.js | JavaScript | var _call_a, _call_a1, _initProto;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _call_a1, _initProto] } = _apply_decs_2203_r(this, [
[
dec,
3,
"a",
function() {
return this.value;
}
],
[
dec,
4,
"a",
function(v) {
this.value = v;
}
]
], []));
}
value = (_initProto(this), 1);
get #a() {
return _call_a(this);
}
set #a(v) {
return _call_a1(this, v);
}
getA() {
return this.#a;
}
setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
set a(v) {
this.value = v;
}
@dec
get ['b']() {
return this.value;
}
@dec
set ['b'](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/public/output.js | JavaScript | var _computedKey, _computedKey1, _initProto;
const dec = ()=>{};
_computedKey = 'b', _computedKey1 = 'b';
class Foo {
static{
({ e: [_initProto] } = _apply_decs_2203_r(this, [
[
dec,
3,
"a"
],
[
dec,
4,
"a"
],
[
dec,
3,
_computedKey
],
[
dec,
4,
_computedKey1
]
], []));
}
value = (_initProto(this), 1);
get a() {
return this.value;
}
set a(v) {
this.value = v;
}
get [_computedKey]() {
return this.value;
}
set [_computedKey1](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
@dec
static set #a(v) {
this.value = v;
}
static getA() {
return this.#a;
}
static setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/static-private/output.js | JavaScript | var _call_a, _call_a1, _initStatic;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _call_a1, _initStatic] } = _apply_decs_2203_r(this, [
[
dec,
8,
"a",
function() {
return this.value;
}
],
[
dec,
9,
"a",
function(v) {
this.value = v;
}
]
], []));
_initStatic(this);
}
static value = 1;
static get #a() {
return _call_a(this);
}
static set #a(v) {
return _call_a1(this, v);
}
static getA() {
return this.#a;
}
static setA(v) {
this.#a = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static set a(v) {
this.value = v;
}
@dec
static get ['b']() {
return this.value;
}
@dec
static set ['b'](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters-and-setters/static-public/output.js | JavaScript | var _computedKey, _computedKey1, _initStatic;
const dec = ()=>{};
_computedKey = 'b', _computedKey1 = 'b';
class Foo {
static{
({ e: [_initStatic] } = _apply_decs_2203_r(this, [
[
dec,
8,
"a"
],
[
dec,
9,
"a"
],
[
dec,
8,
_computedKey
],
[
dec,
9,
_computedKey1
]
], []));
_initStatic(this);
}
static value = 1;
static get a() {
return this.value;
}
static set a(v) {
this.value = v;
}
static get [_computedKey]() {
return this.value;
}
static set [_computedKey1](v) {
this.value = v;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get #a() {
return this.value;
}
getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/private/output.js | JavaScript | var _call_a, _initProto;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _initProto] } = _apply_decs_2203_r(this, [
[
dec,
3,
"a",
function() {
return this.value;
}
]
], []));
}
value = (_initProto(this), 1);
get #a() {
return _call_a(this);
}
getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
get a() {
return this.value;
}
@dec
get ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/public/output.js | JavaScript | var _computedKey, _initProto;
const dec = ()=>{};
_computedKey = 'b';
class Foo {
static{
({ e: [_initProto] } = _apply_decs_2203_r(this, [
[
dec,
3,
"a"
],
[
dec,
3,
_computedKey
]
], []));
}
value = (_initProto(this), 1);
get a() {
return this.value;
}
get [_computedKey]() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get #a() {
return this.value;
}
static getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/static-private/output.js | JavaScript | var _call_a, _initStatic;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _initStatic] } = _apply_decs_2203_r(this, [
[
dec,
8,
"a",
function() {
return this.value;
}
]
], []));
_initStatic(this);
}
static value = 1;
static get #a() {
return _call_a(this);
}
static getA() {
return this.#a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static get a() {
return this.value;
}
@dec
static get ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-getters/static-public/output.js | JavaScript | var _computedKey, _initStatic;
const dec = ()=>{};
_computedKey = 'b';
class Foo {
static{
({ e: [_initStatic] } = _apply_decs_2203_r(this, [
[
dec,
8,
"a"
],
[
dec,
8,
_computedKey
]
], []));
_initStatic(this);
}
static value = 1;
static get a() {
return this.value;
}
static get [_computedKey]() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-metadata/class/exec.js | JavaScript | function dec(_, ctx) {
ctx.metadata.foo = 3;
}
Symbol.metadata = Symbol();
@dec
class A {}
expect(A[Symbol.metadata]).toEqual({ foo: 3 });
expect(Object.getPrototypeOf(A[Symbol.metadata])).toBe(null);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-metadata/element/exec.js | JavaScript | function dec(_, ctx) {
console.error(ctx);
ctx.metadata.foo = 3;
}
Symbol.metadata = Symbol();
class A {
@dec
foo;
}
expect(A[Symbol.metadata]).toEqual({ foo: 3 });
expect(Object.getPrototypeOf(A[Symbol.metadata])).toBe(null);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-metadata/no-decorators/exec.js | JavaScript | Symbol.metadata = Symbol();
class A {}
expect(A.hasOwnProperty(Symbol.metadata)).toBe(false);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-metadata/subclass-no-super-decorators/exec.js | JavaScript | function dec(v) {
return (_, ctx) => {
ctx.metadata.foo = v;
};
}
Symbol.metadata = Symbol();
class B {}
@dec(3)
class A extends B {}
expect(A[Symbol.metadata]).toEqual({ foo: 3 });
expect(Object.getPrototypeOf(A[Symbol.metadata])).toBe(null);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-metadata/subclass-super-decorators/exec.js | JavaScript | function dec(v) {
return (_, ctx) => {
ctx.metadata.foo = v;
};
}
Symbol.metadata = Symbol();
@dec(2)
class B {}
@dec(3)
class A extends B {}
expect(A[Symbol.metadata]).toEqual({ foo: 3 });
expect(Object.getPrototypeOf(A[Symbol.metadata])).toBe(B[Symbol.metadata]);
expect(B[Symbol.metadata]).toEqual({ foo: 2 });
expect(Object.getPrototypeOf(B[Symbol.metadata])).toBe(null);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/private-with-initializers/exec.js | JavaScript | function dec(fn, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return fn.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
#a() {
return this.value;
}
callA() {
return this.#a();
}
}
let foo = new Foo();
const aContext = foo['#aContext'];
// First call gets the method, second call calls the method with correct `this`
expect(aContext.access.get.call(foo).call(foo)).toBe(2);
expect(foo.callA()).toBe(2);
foo.value = 123;
expect(aContext.access.get.call(foo).call(foo)).toBe(124);
expect(foo.callA()).toBe(124);
expect(aContext.name).toBe('#a');
expect(aContext.kind).toBe('method');
expect(aContext.static).toBe(false);
expect(aContext.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-methods--to-es2015/private/exec.js | JavaScript | function dec(fn, context) {
return function () {
return fn.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
#a() {
return this.value;
}
callA() {
return this.#a();
}
}
let foo = new Foo();
expect(foo.callA()).toBe(2);
foo.value = 123;
expect(foo.callA()).toBe(124);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
#a() {
return this.value;
}
callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/private/output.js | JavaScript | var _call_a, _initProto;
const dec = ()=>{};
var _a = /*#__PURE__*/ new WeakMap();
class Foo {
callA() {
return _class_private_field_get(this, _a).call(this);
}
constructor(){
_class_private_field_init(this, _a, {
get: get_a,
set: void 0
});
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_call_a, _initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
2,
"a",
function() {
return this.value;
}
]
], []));
function get_a() {
return _call_a;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/public-with-initializers/exec.js | JavaScript | function dec(fn, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return fn.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
a() {
return this.value;
}
@dec
['b']() {
return this.value;
}
}
let foo = new Foo();
const aContext = foo['aContext'];
const bContext = foo['bContext'];
expect(foo.a()).toBe(2);
expect(aContext.access.get.call(foo).call(foo)).toBe(2);
expect(foo.b()).toBe(2);
expect(bContext.access.get.call(foo).call(foo)).toBe(2);
foo.value = 123;
expect(aContext.access.get.call(foo).call(foo)).toBe(124);
expect(foo.a()).toBe(124);
expect(bContext.access.get.call(foo).call(foo)).toBe(124);
expect(foo.b()).toBe(124);
expect(aContext.name).toBe('a');
expect(aContext.kind).toBe('method');
expect(aContext.static).toBe(false);
expect(aContext.private).toBe(false);
expect(typeof aContext.addInitializer).toBe('function');
expect(bContext.name).toBe('b');
expect(bContext.kind).toBe('method');
expect(bContext.static).toBe(false);
expect(bContext.private).toBe(false);
expect(typeof bContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/public/exec.js | JavaScript | function dec(fn, context) {
return function () {
return fn.call(this) + 1;
}
}
class Foo {
value = 1;
@dec
a() {
return this.value;
}
@dec
['b']() {
return this.value;
}
}
let foo = new Foo();
expect(foo.a()).toBe(2);
expect(foo.b()).toBe(2);
foo.value = 123;
expect(foo.a()).toBe(124);
expect(foo.b()).toBe(124);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
a() {
return this.value;
}
@dec
['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/public/output.js | JavaScript | var _computedKey, _initProto;
const dec = ()=>{};
_computedKey = 'b';
let _computedKey1 = _computedKey;
class Foo {
a() {
return this.value;
}
[_computedKey1]() {
return this.value;
}
constructor(){
_define_property(this, "value", (_initProto(this), 1));
}
}
({ e: [_initProto] } = _apply_decs_2203_r(Foo, [
[
dec,
2,
"a"
],
[
dec,
2,
_computedKey
]
], []));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-private-with-initializers/exec.js | JavaScript | function dec(fn, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return fn.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static #a() {
return this.value;
}
static callA() {
return this.#a();
}
}
const aContext = Foo['#aContext'];
// First call gets the method, second call calls the method with correct `this`
expect(aContext.access.get.call(Foo).call(Foo)).toBe(2);
expect(Foo.callA()).toBe(2);
Foo.value = 123;
expect(aContext.access.get.call(Foo).call(Foo)).toBe(124);
expect(Foo.callA()).toBe(124);
expect(aContext.name).toBe('#a');
expect(aContext.kind).toBe('method');
expect(aContext.static).toBe(true);
expect(aContext.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-methods--to-es2015/static-private/exec.js | JavaScript | function dec(fn, context) {
return function () {
return fn.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static #a() {
return this.value;
}
static callA() {
return this.#a();
}
}
expect(Foo.callA()).toBe(2);
Foo.value = 123;
expect(Foo.callA()).toBe(124);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static #a() {
return this.value;
}
static callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-private/output.js | JavaScript | var _call_a, _initStatic;
const dec = ()=>{};
class Foo {
static callA() {
return _class_static_private_field_spec_get(this, Foo, _a).call(Foo);
}
}
var _a = {
get: get_a,
set: void 0
};
(()=>{
({ e: [_call_a, _initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
7,
"a",
function() {
return this.value;
}
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
function get_a() {
return _call_a;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-public-with-initializers/exec.js | JavaScript | function dec(fn, context) {
context.addInitializer(function() {
this[context.name + 'Context'] = context;
});
return function () {
return fn.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static a() {
return this.value;
}
@dec
static ['b']() {
return this.value;
}
}
const aContext = Foo['aContext'];
const bContext = Foo['bContext'];
expect(Foo.a()).toBe(2);
expect(aContext.access.get.call(Foo).call(Foo)).toBe(2);
expect(Foo.b()).toBe(2);
expect(bContext.access.get.call(Foo).call(Foo)).toBe(2);
Foo.value = 123;
expect(aContext.access.get.call(Foo).call(Foo)).toBe(124);
expect(Foo.a()).toBe(124);
expect(bContext.access.get.call(Foo).call(Foo)).toBe(124);
expect(Foo.b()).toBe(124);
expect(aContext.name).toBe('a');
expect(aContext.kind).toBe('method');
expect(aContext.static).toBe(true);
expect(aContext.private).toBe(false);
expect(typeof aContext.addInitializer).toBe('function');
expect(bContext.name).toBe('b');
expect(bContext.kind).toBe('method');
expect(bContext.static).toBe(true);
expect(bContext.private).toBe(false);
expect(typeof bContext.addInitializer).toBe('function');
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-public/exec.js | JavaScript | function dec(fn, context) {
return function () {
return fn.call(this) + 1;
}
}
class Foo {
static value = 1;
@dec
static a() {
return this.value;
}
@dec
static ['b']() {
return this.value;
}
}
expect(Foo.a()).toBe(2);
expect(Foo.b()).toBe(2);
Foo.value = 123;
expect(Foo.a()).toBe(124);
expect(Foo.b()).toBe(124);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static a() {
return this.value;
}
@dec
static ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods--to-es2015/static-public/output.js | JavaScript | var _computedKey, _initStatic;
const dec = ()=>{};
_computedKey = 'b';
let _computedKey1 = _computedKey;
class Foo {
static a() {
return this.value;
}
static [_computedKey1]() {
return this.value;
}
}
(()=>{
({ e: [_initStatic] } = _apply_decs_2203_r(Foo, [
[
dec,
7,
"a"
],
[
dec,
7,
_computedKey
]
], []));
_initStatic(Foo);
})();
_define_property(Foo, "value", 1);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/private/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
#a() {
return this.value;
}
callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/private/output.js | JavaScript | var _call_a, _initProto;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _initProto] } = _apply_decs_2203_r(this, [
[
dec,
2,
"a",
function() {
return this.value;
}
]
], []));
}
value = (_initProto(this), 1);
get #a() {
return _call_a;
}
callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/public/input.js | JavaScript | const dec = () => {};
class Foo {
value = 1;
@dec
a() {
return this.value;
}
@dec
['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/public/output.js | JavaScript | var _computedKey, _initProto;
const dec = ()=>{};
_computedKey = 'b';
class Foo {
static{
({ e: [_initProto] } = _apply_decs_2203_r(this, [
[
dec,
2,
"a"
],
[
dec,
2,
_computedKey
]
], []));
}
value = (_initProto(this), 1);
a() {
return this.value;
}
[_computedKey]() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/static-private/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static #a() {
return this.value;
}
static callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/static-private/output.js | JavaScript | var _call_a, _initStatic;
const dec = ()=>{};
class Foo {
static{
({ e: [_call_a, _initStatic] } = _apply_decs_2203_r(this, [
[
dec,
7,
"a",
function() {
return this.value;
}
]
], []));
_initStatic(this);
}
static value = 1;
static get #a() {
return _call_a;
}
static callA() {
return this.#a();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/static-public/input.js | JavaScript | const dec = () => {};
class Foo {
static value = 1;
@dec
static a() {
return this.value;
}
@dec
static ['b']() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-methods/static-public/output.js | JavaScript | var _computedKey, _initStatic;
const dec = ()=>{};
_computedKey = 'b';
class Foo {
static{
({ e: [_initStatic] } = _apply_decs_2203_r(this, [
[
dec,
7,
"a"
],
[
dec,
7,
_computedKey
]
], []));
_initStatic(this);
}
static value = 1;
static a() {
return this.value;
}
static [_computedKey]() {
return this.value;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/class-and-method-decorators/exec.js | JavaScript | function dec() {}
var i = 0;
var log = [];
function push(x) { log.push(x); return x; }
function decWithInitializer(_, { addInitializer }) {
addInitializer(() => push(i++) );
}
new @dec class C1 {
@dec static m() {}
}
new @dec class C2 {
@dec static #m() {}
}
new @dec class C3 {
@dec m() {}
}
new @dec class C4 {
@dec #m() {}
}
new @decWithInitializer class C5 {
@dec static m() {}
}
new @decWithInitializer class C6 {
@dec static #m() {}
}
new @decWithInitializer class C7 {
@dec m() {}
}
new @decWithInitializer class C8 {
@dec #m() {}
}
new @dec class C9 {
@decWithInitializer static m() {}
}
new @dec class C10 {
@decWithInitializer static #m() {}
}
new @dec class C11 {
@decWithInitializer m() {}
}
new @dec class C12 {
@decWithInitializer #m() {}
}
new @decWithInitializer class C13 {
@decWithInitializer static m() {}
}
new @decWithInitializer class C14 {
@decWithInitializer static #m() {}
}
new @decWithInitializer class C15 {
@decWithInitializer m() {}
}
new @decWithInitializer class C16 {
@decWithInitializer #m() {}
}
var nums = Array.from({ length: 16 }, (_, i) => i);
expect(log).toEqual(nums);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/class-and-property-decorators/exec.js | JavaScript | function dec() {}
var i = 0;
var log = [];
function push(x) { log.push(x); return x; }
function decWithInitializer(_, { addInitializer }) {
addInitializer(() => push(i++) );
}
new @dec class C1 {
@dec static p
}
new @dec class C2 {
@dec static #p
}
new @dec class C3 {
@dec p
}
new @dec class C4 {
@dec #p
}
new @decWithInitializer class C5 {
@dec static p
}
new @decWithInitializer class C6 {
@dec static #p
}
new @decWithInitializer class C7 {
@dec p
}
new @decWithInitializer class C8 {
@dec #p
}
var nums = Array.from({ length: 4 }, (_, i) => i);
expect(log).toEqual(nums);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/decorator-evaluation-scope/exec.js | JavaScript | let receivedName;
function decFactory(name) { receivedName = name; return x => x }
class B {
static m() {
class C {
@decFactory(this.name) p;
}
}
}
B.m();
expect(receivedName).toBe("B");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/initProto-existing-derived-constructor/exec.js | JavaScript | let self, a, initCalled;
function deco(_, context) {
context.addInitializer(() => {
initCalled = true;
})
}
class B {
constructor(s) {
a = s;
}
}
class A extends B {
constructor() {
let a = 2;
self = super(a);
}
@deco
method() {}
}
let instance = new A();
expect(self).toBe(instance);
expect(a).toBe(2);
expect(initCalled).toBe(true);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/initProto-existing-derived-constructor/input.js | JavaScript | const dec = () => {};
class A extends B {
constructor() {
let a = 2;
super(a);
foo();
}
@deco
method() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/initProto-existing-derived-constructor/output.js | JavaScript | var _initProto;
const dec = ()=>{};
class A extends B {
method() {}
constructor(){
let a = 2;
super(a), _initProto(this);
foo();
}
}
({ e: [_initProto] } = _apply_decs_2203_r(A, [
[
deco,
2,
"method"
]
], []));
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/initializer-property-ignored/exec.js | JavaScript | let init = false;
let initializer = false;
function decorator() {
return {
get init() {
init = true;
return () => {};
},
get initializer() {
initializer = true;
return () => {};
}
};
}
class A {
@decorator
accessor x;
}
new A();
expect(init).toBe(true);
expect(initializer).toBe(false);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/initializer-timing/exec.js | JavaScript | function dec1(fn, context) {
context.addInitializer((instance) => {
expect(instance.value).toBe(undefined);
});
return fn;
}
class Foo {
value = 1;
@dec1
foo() {}
}
function dec2(fn, context) {
context.addInitializer((instance) => {
expect(instance.value).toBe(1);
});
return fn;
}
class Bar extends Foo {
constructor() {
super();
this.value = 2;
}
@dec2
bar() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/leaked-context-addInitializer-throw/exec.js | JavaScript | let addInitializer;
function decMethod(_, context) {
({ addInitializer } = context);
addInitializer(() => null);
}
try {
class C {
@decMethod
m() {}
}
} finally {}
expect(() => {
addInitializer(() => null);
}).toThrow('attempted to call addInitializer after decoration was finished')
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/leaked-context-addInitializer/exec.js | JavaScript | let addInitializer;
function callCapturedFunc() {
addInitializer(() => null);
}
function decMethod(_, context) {
({ addInitializer } = context);
addInitializer(() => null);
}
expect(() => {
class C {
@callCapturedFunc
@decMethod
m() {}
}
}).toThrow('attempted to call addInitializer after decoration was finished')
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/valid-expression-formats/input.js | JavaScript | const dec = () => {};
@dec
@call()
@chain.expr()
@(arbitrary + expr)
@(array[expr])
class Foo {
#a;
@dec
@call()
@chain.expr()
@(arbitrary + expr)
@(array[expr])
method() {}
makeClass() {
return class Nested {
@(this.#a)
bar;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/valid-expression-formats/output.js | JavaScript | var _dec, _dec1, _dec2, _dec3, _initClass, _dec4, _dec5, _dec6, _dec7, _initProto;
const dec = ()=>{};
let _Foo;
_dec = call(), _dec1 = chain.expr(), _dec2 = arbitrary + expr, _dec3 = array[expr], _dec4 = call(), _dec5 = chain.expr(), _dec6 = arbitrary + expr, _dec7 = array[expr];
var _a = /*#__PURE__*/ new WeakMap();
class Foo {
method() {}
makeClass() {
var _Nested;
var _dec, _init_bar;
_dec = _class_private_field_get(this, _a);
return _Nested = class Nested {
constructor(){
_define_property(this, "bar", _init_bar(this));
}
}, { e: [_init_bar] } = _apply_decs_2203_r(_Nested, [
[
_dec,
0,
"bar"
]
], []), _Nested;
}
constructor(){
_class_private_field_init(this, _a, {
writable: true,
value: void 0
});
_initProto(this);
}
}
({ e: [_initProto], c: [_Foo, _initClass] } = _apply_decs_2203_r(Foo, [
[
[
dec,
_dec4,
_dec5,
_dec6,
_dec7
],
2,
"method"
]
], [
dec,
_dec,
_dec1,
_dec2,
_dec3
]));
_initClass();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/all-decorators/input.js | JavaScript | const dec = () => {};
@dec
class Class {
@dec a;
@dec b() {}
@dec get c() {}
@dec set c(v) {}
@dec accessor d;
@dec #e;
@dec #f() {}
@dec get #g() {}
@dec set #g(v) {}
@dec accessor #h;
@dec static i;
@dec static j() {}
@dec static get k() {}
@dec static set l(v) {}
@dec static accessor m;
@dec static #n;
@dec static #o() {}
@dec static get #p() {}
@dec static set #q(v) {}
@dec static accessor #r;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/all-decorators/output.js | JavaScript | var _initClass, _init_d, _call_f, _call_g, _call_g1, _init_h, _get___h, _set___h, _init_m, _call_o, _call_p, _call_q, _init_r, _get___r, _set___r, _init_a, _init_e, _init_i, _init_n, _initProto, _initStatic;
const dec = ()=>{};
let _Class;
new class extends _identity {
constructor(){
super(_Class), _initClass();
}
static{
class Class {
static{
({ e: [_init_m, _call_o, _call_p, _call_q, _init_r, _get___r, _set___r, _init_i, _init_n, _init_d, _call_f, _call_g, _call_g1, _init_h, _get___h, _set___h, _init_a, _init_e, _initProto, _initStatic], c: [_Class, _initClass] } = _apply_decs_2203_r(this, [
[
dec,
7,
"j"
],
[
dec,
8,
"k"
],
[
dec,
9,
"l"
],
[
dec,
6,
"m"
],
[
dec,
7,
"o",
function() {}
],
[
dec,
8,
"p",
function() {}
],
[
dec,
9,
"q",
function(v) {}
],
[
dec,
6,
"r",
function() {
return this.#__r_4;
},
function(_v) {
this.#__r_4 = _v;
}
],
[
dec,
5,
"i"
],
[
dec,
5,
"n",
function() {
return this.#n;
},
function(value) {
this.#n = value;
}
],
[
dec,
2,
"b"
],
[
dec,
3,
"c"
],
[
dec,
4,
"c"
],
[
dec,
1,
"d"
],
[
dec,
2,
"f",
function() {}
],
[
dec,
3,
"g",
function() {}
],
[
dec,
4,
"g",
function(v) {}
],
[
dec,
1,
"h",
function() {
return this.#__h_2;
},
function(_v) {
this.#__h_2 = _v;
}
],
[
dec,
0,
"a"
],
[
dec,
0,
"e",
function() {
return this.#e;
},
function(value) {
this.#e = value;
}
]
], [
dec
]));
_initStatic(this);
}
a = (_initProto(this), _init_a(this));
b() {}
get c() {}
set c(v) {}
#___private_d_1 = _init_d(this);
get d() {
return this.#___private_d_1;
}
set d(_v) {
this.#___private_d_1 = _v;
}
#e = _init_e(this);
get #f() {
return _call_f;
}
get #g() {
return _call_g(this);
}
set #g(v) {
return _call_g1(this, v);
}
#__h_2 = _init_h(this);
get #h() {
return _get___h(this);
}
set #h(_v) {
_set___h(this, _v);
}
static i = _init_i(this);
static j() {}
static get k() {}
static set l(v) {}
static get m() {
return this.#___private_m_3;
}
static set m(_v) {
this.#___private_m_3 = _v;
}
}
}
#___private_m_3 = _init_m(this);
#n = _init_n(this);
get #o() {
return _call_o;
}
get #p() {
return _call_p(this);
}
set #q(v) {
return _call_q(this, v);
}
#__r_4 = _init_r(this);
get #r() {
return _get___r(this);
}
set #r(_v) {
_set___r(this, _v);
}
}();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/decorator-evaluation-scope/exec.js | JavaScript | let receivedName;
function decFactory(name) { receivedName = name; return x => x }
class B {
static m() {
class C {
@decFactory(this.name) p;
}
}
}
B.m();
expect(receivedName).toBe("B");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/initProto-existing-derived-constructor-multiple-super/input.js | JavaScript | const dec = () => {};
class A extends B {
constructor() {
if (Math.random() > 0.5) {
super(true);
} else {
super(false);
}
}
@deco
method() {}
}
class C extends B {
constructor() {
try {
super(super(), null.x);
} catch {}
}
@deco
method() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/initProto-existing-derived-constructor-multiple-super/output.js | JavaScript | var _initProto, _initProto1;
const dec = ()=>{};
class A extends B {
static{
({ e: [_initProto] } = _apply_decs_2203_r(this, [
[
deco,
2,
"method"
]
], []));
}
constructor(){
if (Math.random() > 0.5) {
super(true), _initProto(this);
} else {
super(false), _initProto(this);
}
}
method() {}
}
class C extends B {
static{
({ e: [_initProto1] } = _apply_decs_2203_r(this, [
[
deco,
2,
"method"
]
], []));
}
constructor(){
try {
super([
super(),
_initProto1(this)
][0], null.x), _initProto1(this);
} catch {}
}
method() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/initProto-existing-derived-constructor/input.js | JavaScript | const dec = () => {};
class A extends B {
constructor() {
let a = 2;
super(a);
foo();
}
@dec
method() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/initProto-existing-derived-constructor/output.js | JavaScript | var _initProto;
const dec = ()=>{};
class A extends B {
static{
({ e: [_initProto] } = _apply_decs_2203_r(this, [
[
dec,
2,
"method"
]
], []));
}
constructor(){
let a = 2;
super(a), _initProto(this);
foo();
}
method() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/initializer-property-ignored/exec.js | JavaScript | let init = false;
let initializer = false;
function decorator() {
return {
get init() {
init = true;
return () => {};
},
get initializer() {
initializer = true;
return () => {};
}
};
}
class A {
@decorator
accessor x;
}
new A();
expect(init).toBe(true);
expect(initializer).toBe(false);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/private-keys-in-enclosing-class/input.js | JavaScript | const dec = () => {};
class A {
#A = 1;
static B = class B extends A {
accessor a = 2;
getA() {
return this.#A;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/private-keys-in-enclosing-class/output.js | JavaScript | const dec = ()=>{};
class A {
#A = 1;
static B = class B extends A {
#___private_a_1 = 2;
get a() {
return this.#___private_a_1;
}
set a(_v) {
this.#___private_a_1 = _v;
}
getA() {
return this.#A;
}
};
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.