1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 14:05:09 +00:00

LibJS: Add argument(i) and argument_count() to Interpreter

Add some convenience accessors for retrieving arguments from the
current call frame.
This commit is contained in:
Andreas Kling 2020-04-01 22:38:59 +02:00
parent 1549c5c48b
commit cd1d369cdd
9 changed files with 49 additions and 34 deletions

View file

@ -43,9 +43,9 @@ ConsoleObject::~ConsoleObject()
Value ConsoleObject::log(Interpreter& interpreter)
{
for (size_t i = 0; i < interpreter.call_frame().arguments.size(); ++i) {
printf("%s", interpreter.call_frame().arguments[i].to_string().characters());
if (i != interpreter.call_frame().arguments.size() - 1)
for (size_t i = 0; i < interpreter.argument_count(); ++i) {
printf("%s", interpreter.argument(i).to_string().characters());
if (i != interpreter.argument_count() - 1)
putchar(' ');
}
putchar('\n');