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
commit cd1d369cdd
Notes: sideshowbarker 2024-07-19 08:00:21 +09:00
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');