mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibJS: Add some helpers and use them to re-implement Console functions
Also add const overloads for some getters. Also const-qualify Interpreter::join_arguments().
This commit is contained in:
committed by
Andreas Kling
parent
92815f313a
commit
bc7ed4524e
@@ -262,7 +262,7 @@ const GlobalObject& Interpreter::global_object() const
|
||||
return static_cast<const GlobalObject&>(*m_global_object);
|
||||
}
|
||||
|
||||
String Interpreter::join_arguments()
|
||||
String Interpreter::join_arguments() const
|
||||
{
|
||||
StringBuilder joined_arguments;
|
||||
for (size_t i = 0; i < argument_count(); ++i) {
|
||||
@@ -273,4 +273,13 @@ String Interpreter::join_arguments()
|
||||
return joined_arguments.build();
|
||||
}
|
||||
|
||||
Vector<String> Interpreter::get_trace() const
|
||||
{
|
||||
Vector<String> trace;
|
||||
// -2 to skip the console.trace() call frame
|
||||
for (ssize_t i = m_call_stack.size() - 2; i >= 0; --i)
|
||||
trace.append(m_call_stack[i].function_name);
|
||||
return trace;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user