diff options
author | Hendiadyoin1 <leon.a@serenityos.org> | 2022-10-02 11:50:13 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-02 18:49:17 +0100 |
commit | baa4d6966814f336f534db8485c1e9acd84e0447 (patch) | |
tree | c934df2ab7c56ac0130e380569c6881651f5bb0a /Userland/Libraries/LibJS | |
parent | 7618f2290fb92c486b2101aa28e0c44119bf8640 (diff) | |
download | serenity-baa4d6966814f336f534db8485c1e9acd84e0447.zip |
LibJS: Set class' source text in NewClass instruction
This fixes the classes toString method.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 07a029ba8a..58be7e29d6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -944,7 +944,10 @@ ThrowCompletionOr<void> NewClass::execute_impl(Bytecode::Interpreter& interprete auto name = m_class_expression.name(); auto scope = interpreter.ast_interpreter_scope(); 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; return {}; } |