mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
LibJS: Move Interpreter::get_trace() to ConsoleClient
Having it globally on the interpreter is confusing as the last call frame is skipped, which is specific to console.trace().
This commit is contained in:
parent
9e3127785e
commit
a48080f62d
6 changed files with 14 additions and 12 deletions
|
@ -120,4 +120,14 @@ bool Console::counter_reset(String label)
|
|||
return true;
|
||||
}
|
||||
|
||||
Vector<String> ConsoleClient::get_trace() const
|
||||
{
|
||||
Vector<String> trace;
|
||||
auto call_stack = m_console.interpreter().call_stack();
|
||||
// -2 to skip the console.trace() call frame
|
||||
for (ssize_t i = call_stack.size() - 2; i >= 0; --i)
|
||||
trace.append(call_stack[i].function_name);
|
||||
return trace;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue