mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +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:
parent
046f9cf115
commit
73bead5ae9
3 changed files with 20 additions and 17 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue