forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7f8401
commit 0427910
Showing
5 changed files
with
89 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...sal-decorators/test/fixtures/2023-05-misc--to-es2015/ctx-access-public-other-this/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function dec(v, context) { | ||
context.addInitializer(function () { | ||
this[context.name + 'Context'] = context; | ||
}); | ||
|
||
return v; | ||
} | ||
|
||
class Foo { | ||
@dec | ||
static accessor a; | ||
|
||
_b = 1; | ||
|
||
@dec | ||
set b(v) { | ||
this._b = v + 1; | ||
} | ||
} | ||
|
||
const obj = {}; | ||
const foo = new Foo(); | ||
|
||
const aContext = Foo.aContext; | ||
const bContext = foo.bContext; | ||
|
||
aContext.access.set(Foo, 123); | ||
|
||
bContext.access.set(foo, 123); | ||
|
||
|
||
aContext.access.set(obj, 456); | ||
bContext.access.set(obj, 456); | ||
|
||
expect(Foo.a).toBe(123); | ||
expect(foo._b).toBe(124); | ||
|
||
expect(obj.a).toBe(456); | ||
expect(obj.b).toBe(456); |
39 changes: 39 additions & 0 deletions
39
...lugin-proposal-decorators/test/fixtures/2023-05-misc/ctx-access-public-other-this/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function dec(v, context) { | ||
context.addInitializer(function () { | ||
this[context.name + 'Context'] = context; | ||
}); | ||
|
||
return v; | ||
} | ||
|
||
class Foo { | ||
@dec | ||
static accessor a; | ||
|
||
_b = 1; | ||
|
||
@dec | ||
set b(v) { | ||
this._b = v + 1; | ||
} | ||
} | ||
|
||
const obj = {}; | ||
const foo = new Foo(); | ||
|
||
const aContext = Foo.aContext; | ||
const bContext = foo.bContext; | ||
|
||
aContext.access.set(Foo, 123); | ||
|
||
bContext.access.set(foo, 123); | ||
|
||
|
||
aContext.access.set(obj, 456); | ||
bContext.access.set(obj, 456); | ||
|
||
expect(Foo.a).toBe(123); | ||
expect(foo._b).toBe(124); | ||
|
||
expect(obj.a).toBe(456); | ||
expect(obj.b).toBe(456); |
3 changes: 3 additions & 0 deletions
3
...-proposal-decorators/test/fixtures/2023-05-misc/ctx-access-public-other-this/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"minNodeVersion": "16.11.0" | ||
} |