mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:07:45 +00:00
LibJS: Implement async functions as generator functions in BC mode
This applies a simple transformation, and adds a simple wrapper that translates the generator interface to the async function interface.
This commit is contained in:
parent
c604e95993
commit
3b0bf05fa5
14 changed files with 192 additions and 43 deletions
|
@ -13,7 +13,7 @@ namespace JS {
|
|||
|
||||
ThrowCompletionOr<Object*> promise_resolve(GlobalObject&, Object& constructor, Value);
|
||||
|
||||
class Promise final : public Object {
|
||||
class Promise : public Object {
|
||||
JS_OBJECT(Promise, Object);
|
||||
|
||||
public:
|
||||
|
@ -45,9 +45,10 @@ public:
|
|||
Value reject(Value reason);
|
||||
Value perform_then(Value on_fulfilled, Value on_rejected, Optional<PromiseCapability> result_capability);
|
||||
|
||||
private:
|
||||
protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
bool is_settled() const { return m_state == State::Fulfilled || m_state == State::Rejected; }
|
||||
|
||||
void trigger_reactions() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue