FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Ensure decorators are callable by JLHwung · Pull Request #16388 · babel/babel · GitHub

/ babel Public

Ensure decorators are callable - #16388

Merged
JLHwung merged 2 commits into
babel:mainfrom
JLHwung:assert-callable-decorator
Mar 28, 2024
Merged

JLHwung merged 2 commits into
babel:mainfrom
JLHwung:assert-callable-decorator

Conversation

JLHwung commented Mar 28, 2024

Copy link
Copy Markdown
Contributor
Q                       A
Fixed Issues? A non-callable decorator should be rejected. REPL
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In the REPL example,

const nonCallable = { call() {}, bind() {}, apply() {} }

@nonCallable
class C {
  @nonCallable field;
  @nonCallable method() {}
}

we should have asserted the decorator is callable before we invoke the call method, as is required by the spec 7.3.13 Call. We have similar guards for initializers and the decorated class, but somehow we missed the decorators.

JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Decorators labels Mar 28, 2024

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56587

JLHwung merged commit efcc01c into babel:main Mar 28, 2024
JLHwung deleted the assert-callable-decorator branch March 28, 2024 23:21
github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 28, 2024
github-actions Bot locked as resolved and limited conversation to collaborators Jun 28, 2024
This file contains hidden or 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Decorators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL