1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:47:37 +00:00

LibJS: Add the remaining generator objects

- %GeneratorFunction%
- %GeneratorFunction.prototype%
- %GeneratorFunction.prototype.prototype%
- %Generator%.prototype
This commit is contained in:
Matthew Olsson 2021-06-15 00:04:08 -07:00 committed by Linus Groh
parent b205c9814a
commit 22b17219ff
14 changed files with 302 additions and 67 deletions

View file

@ -16,20 +16,15 @@ class GeneratorObject final : public Object {
public:
static GeneratorObject* create(GlobalObject&, Value, ScriptFunction*, ScopeObject*, Bytecode::RegisterWindow);
explicit GeneratorObject(GlobalObject&);
GeneratorObject(GlobalObject&, Object& prototype);
virtual void initialize(GlobalObject&) override;
virtual ~GeneratorObject() override;
void visit_edges(Cell::Visitor&) override;
static GeneratorObject* typed_this(VM&, GlobalObject&);
Value next_impl(VM&, GlobalObject&, Optional<Value> value_to_throw);
void set_done() { m_done = true; }
private:
JS_DECLARE_NATIVE_FUNCTION(next);
JS_DECLARE_NATIVE_FUNCTION(return_);
JS_DECLARE_NATIVE_FUNCTION(throw_);
Value next_impl(VM&, GlobalObject&, Optional<Value> value_to_throw);
ScopeObject* m_scope { nullptr };
ScriptFunction* m_generating_function { nullptr };
Value m_previous_value;