mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibJS: Move join_args() in Interpreter
It can be useful outside of Runtime/ConsoleObject.cpp. join_args() => Interpreter::join_arguments()
This commit is contained in:
committed by
Andreas Kling
parent
046f9cf115
commit
73bead5ae9
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
@@ -261,4 +262,15 @@ const GlobalObject& Interpreter::global_object() const
|
||||
return static_cast<const GlobalObject&>(*m_global_object);
|
||||
}
|
||||
|
||||
String Interpreter::join_arguments()
|
||||
{
|
||||
StringBuilder joined_arguments;
|
||||
for (size_t i = 0; i < argument_count(); ++i) {
|
||||
joined_arguments.append(argument(i).to_string().characters());
|
||||
if (i != argument_count() - 1)
|
||||
joined_arguments.append(' ');
|
||||
}
|
||||
return joined_arguments.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user