blob: 08d722f6648a719a73a7ef471c7ae7c045826ce8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/ScriptFunction.h>
namespace JS {
class GeneratorObject final : public Object {
JS_OBJECT(GeneratorObject, Object);
public:
static GeneratorObject* create(GlobalObject&, Value, ScriptFunction*, EnvironmentRecord*, Bytecode::RegisterWindow);
GeneratorObject(GlobalObject&, Object& prototype);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorObject() override;
void visit_edges(Cell::Visitor&) override;
Value next_impl(VM&, GlobalObject&, Optional<Value> value_to_throw);
void set_done() { m_done = true; }
private:
EnvironmentRecord* m_environment_record { nullptr };
ScriptFunction* m_generating_function { nullptr };
Value m_previous_value;
Bytecode::RegisterWindow m_frame;
bool m_done { false };
};
}
|