From 9d22db2802a212856e3a9fbb573f0bbfb56e387d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 31 May 2024 20:59:55 +0200 Subject: [PATCH] LibJS/Bytecode: Pretty-print the `this` register as "this" --- Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index ddc13403c27..9bd033a3086 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -46,7 +46,11 @@ static ByteString format_operand(StringView name, Operand operand, Bytecode::Exe builder.appendff("\033[32m{}\033[0m:", name); switch (operand.type()) { case Operand::Type::Register: - builder.appendff("\033[33mreg{}\033[0m", operand.index()); + if (operand.index() == Register::this_value().index()) { + builder.appendff("\033[33mthis\033[0m"); + } else { + builder.appendff("\033[33mreg{}\033[0m", operand.index()); + } break; case Operand::Type::Local: // FIXME: Show local name.