mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +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
|
@ -16,17 +16,17 @@ class GeneratorObject final : public Object {
|
|||
JS_OBJECT(GeneratorObject, Object);
|
||||
|
||||
public:
|
||||
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, Environment*, Bytecode::RegisterWindow);
|
||||
GeneratorObject(GlobalObject&, Object& prototype);
|
||||
static ThrowCompletionOr<GeneratorObject*> create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
|
||||
GeneratorObject(GlobalObject&, Object& prototype, ExecutionContext);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~GeneratorObject() override;
|
||||
void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
ThrowCompletionOr<Value> next_impl(VM&, GlobalObject&, Optional<Value> value_to_throw);
|
||||
ThrowCompletionOr<Value> next_impl(VM&, GlobalObject&, Optional<Value> next_argument, Optional<Value> value_to_throw);
|
||||
void set_done() { m_done = true; }
|
||||
|
||||
private:
|
||||
Environment* m_environment { nullptr };
|
||||
ExecutionContext m_execution_context;
|
||||
ECMAScriptFunctionObject* m_generating_function { nullptr };
|
||||
Value m_previous_value;
|
||||
Bytecode::RegisterWindow m_frame;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue