-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JSC] Implement Promise.try #24802
[JSC] Implement Promise.try #24802
Conversation
EWS run on current version of this PR (hash adb9e75) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Commit message contains (OOPS!) and no reviewer found, blocking PR #24802 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
https://bugs.webkit.org/show_bug.cgi?id=269775 Reviewed by Justin Michaud. This patch implements https://github.com/tc39/proposal-promise-try behind a runtime option; the proposal is currently at Stage 2 but the spec is very simple and not expected to change. Effectively, Promise.try(f) is a more convenient way to write `new Promise((resolve) => { resolve(f()); })` -- we don't care whether f is sync or async, but if is synchronous, we want it to be executed immediately. This implementation includes tc39/proposal-promise-try#16, which the champion expects to merge; it simply extends the API to Promise.try(f, ...args) such that arguments can be forwarded to the callback. * JSTests/stress/promise-try.js: Added. * Source/JavaScriptCore/builtins/PromiseConstructor.js: (try): Added. * Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp: (JSC::JSPromiseConstructor::finishCreation): * Source/JavaScriptCore/runtime/OptionsList.h: Canonical link: https://commits.webkit.org/275081@main
adb9e75
to
6d51d57
Compare
Committed 275081@main (6d51d57): https://commits.webkit.org/275081@main Reviewed commits have been landed. Closing PR #24802 and removing active labels. |
6d51d57
adb9e75