summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ScriptFunction.h
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-11 01:38:30 +0430
committerAndreas Kling <kling@serenityos.org>2021-06-11 00:30:09 +0200
commit3234697ecacb41e15e230a450f2759f404c8b047 (patch)
tree54b9b4de011c95644a4ceb3ce694b79bdcf0ce49 /Userland/Libraries/LibJS/Runtime/ScriptFunction.h
parentc53a86a3fe530d6adaa095944a59a8a0333be3c6 (diff)
downloadserenity-3234697ecacb41e15e230a450f2759f404c8b047.zip
LibJS: Implement generator functions (only in bytecode mode)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ScriptFunction.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ScriptFunction.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ScriptFunction.h b/Userland/Libraries/LibJS/Runtime/ScriptFunction.h
index edc748130b..fa93085e5d 100644
--- a/Userland/Libraries/LibJS/Runtime/ScriptFunction.h
+++ b/Userland/Libraries/LibJS/Runtime/ScriptFunction.h
@@ -16,9 +16,9 @@ class ScriptFunction final : public Function {
JS_OBJECT(ScriptFunction, Function);
public:
- static ScriptFunction* create(GlobalObject&, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, ScopeObject* parent_scope, bool is_strict, bool is_arrow_function = false);
+ static ScriptFunction* create(GlobalObject&, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, ScopeObject* parent_scope, bool is_generator, bool is_strict, bool is_arrow_function = false);
- ScriptFunction(GlobalObject&, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, ScopeObject* parent_scope, Object& prototype, bool is_strict, bool is_arrow_function = false);
+ ScriptFunction(GlobalObject&, const FlyString& name, const Statement& body, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, ScopeObject* parent_scope, Object& prototype, bool is_generator, bool is_strict, bool is_arrow_function = false);
virtual void initialize(GlobalObject&) override;
virtual ~ScriptFunction();
@@ -33,6 +33,8 @@ public:
void set_is_class_constructor() { m_is_class_constructor = true; };
+ auto& bytecode_executable() const { return m_bytecode_executable; }
+
protected:
virtual bool is_strict_mode() const final { return m_is_strict; }
@@ -51,6 +53,7 @@ private:
Optional<Bytecode::Executable> m_bytecode_executable;
ScopeObject* m_parent_scope { nullptr };
i32 m_function_length { 0 };
+ bool m_is_generator { false };
bool m_is_strict { false };
bool m_is_arrow_function { false };
bool m_is_class_constructor { false };