Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update decorators to the latest spec
- Update `initialize` -> `init` - Update decorator application ordering: 1. Static method decorators 2. Proto method decorators 3. Static field decorators 4. Proto field decorators - Throw errors when `addInitializer` or metadata methods are called outside of decoration
- Loading branch information
Showing
23 changed files
with
296 additions
and
162 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
14 changes: 14 additions & 0 deletions
14
...al-decorators/test/fixtures/2021-12-misc--to-es2015/leaked-context-addInitializer/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,14 @@ | ||
let addInitializer; | ||
|
||
function decMethod(_, context) { | ||
({ addInitializer } = context); | ||
addInitializer(() => null); | ||
} | ||
|
||
class C { | ||
@decMethod m() {} | ||
} | ||
|
||
expect(() => { | ||
addInitializer(() => null); | ||
}).toThrow('attempted to call addInitializer after decoration was finished') |
15 changes: 15 additions & 0 deletions
15
...osal-decorators/test/fixtures/2021-12-misc--to-es2015/leaked-context-get-metadata/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,15 @@ | ||
let getMetadata; | ||
let metadataSymbol = Symbol(); | ||
|
||
function decMethod(_, context) { | ||
({ getMetadata } = context); | ||
getMetadata(metadataSymbol); | ||
} | ||
|
||
class C { | ||
@decMethod m() {} | ||
} | ||
|
||
expect(() => { | ||
getMetadata(metadataSymbol); | ||
}).toThrow('attempted to call getMetadata after decoration was finished') |
15 changes: 15 additions & 0 deletions
15
...osal-decorators/test/fixtures/2021-12-misc--to-es2015/leaked-context-set-metadata/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,15 @@ | ||
let setMetadata; | ||
let metadataSymbol = Symbol(); | ||
|
||
function decMethod(_, context) { | ||
({ setMetadata } = context); | ||
setMetadata(metadataSymbol, 'value'); | ||
} | ||
|
||
class C { | ||
@decMethod m() {} | ||
} | ||
|
||
expect(() => { | ||
setMetadata(metadataSymbol, 'value'); | ||
}).toThrow('attempted to call setMetadata after decoration was finished') |
Oops, something went wrong.