1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS/Bytecode: Set "home object" of functions within object expression

We manage this by having a stack of home objects in Generator, and then
adding an optional home object parameter to the NewFunction instruction.
This commit is contained in:
Andreas Kling 2023-06-16 10:25:05 +02:00
parent a33af174b2
commit c9bd324369
5 changed files with 45 additions and 4 deletions

View file

@ -83,6 +83,10 @@ public:
CodeGenerationErrorOr<void> emit_store_to_reference(JS::ASTNode const&);
CodeGenerationErrorOr<void> emit_delete_reference(JS::ASTNode const&);
void push_home_object(Register);
void pop_home_object();
void emit_new_function(JS::FunctionNode const&);
void begin_continuable_scope(Label continue_target, Vector<DeprecatedFlyString> const& language_label_set);
void end_continuable_scope();
void begin_breakable_scope(Label breakable_target, Vector<DeprecatedFlyString> const& language_label_set);
@ -237,6 +241,7 @@ private:
Vector<LabelableScope> m_breakable_scopes;
Vector<LexicalScope> m_variable_scopes;
Vector<BlockBoundaryType> m_boundaries;
Vector<Register> m_home_objects;
};
}