mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
LibJS: Set class' source text in NewClass instruction
This fixes the classes toString method.
This commit is contained in:
parent
7618f2290f
commit
baa4d69668
1 changed files with 4 additions and 1 deletions
|
@ -944,7 +944,10 @@ ThrowCompletionOr<void> NewClass::execute_impl(Bytecode::Interpreter& interprete
|
||||||
auto name = m_class_expression.name();
|
auto name = m_class_expression.name();
|
||||||
auto scope = interpreter.ast_interpreter_scope();
|
auto scope = interpreter.ast_interpreter_scope();
|
||||||
auto& ast_interpreter = scope.interpreter();
|
auto& ast_interpreter = scope.interpreter();
|
||||||
auto class_object = TRY(m_class_expression.class_definition_evaluation(ast_interpreter, name, name.is_null() ? ""sv : name));
|
|
||||||
|
auto* class_object = TRY(m_class_expression.class_definition_evaluation(ast_interpreter, name, name.is_null() ? ""sv : name));
|
||||||
|
class_object->set_source_text(m_class_expression.source_text());
|
||||||
|
|
||||||
interpreter.accumulator() = class_object;
|
interpreter.accumulator() = class_object;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue