ladybird/Userland/Libraries/LibJS/Runtime/GeneratorObject.h
Andreas Kling c8270dbe2e LibJS: Rename ScriptFunction => OrdinaryFunctionObject
These are basically what the spec calls "ordinary function objects",
so let's have the name reflect that. :^)
2021-06-27 22:36:04 +02:00

35 lines
993 B
C++

/*
* 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/OrdinaryFunctionObject.h>
namespace JS {
class GeneratorObject final : public Object {
JS_OBJECT(GeneratorObject, Object);
public:
static GeneratorObject* create(GlobalObject&, Value, OrdinaryFunctionObject*, 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 };
OrdinaryFunctionObject* m_generating_function { nullptr };
Value m_previous_value;
Bytecode::RegisterWindow m_frame;
bool m_done { false };
};
}