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

LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]

This is where the fun begins. :^)
This commit is contained in:
Linus Groh 2022-08-21 14:00:56 +01:00
parent f6c4a0f5d0
commit a022e548b8
129 changed files with 1230 additions and 1325 deletions

View file

@ -1266,7 +1266,7 @@ static JS::ThrowCompletionOr<JS::Value> load_ini_impl(JS::VM& vm, JS::GlobalObje
{
auto& realm = *global_object.associated_realm();
auto filename = TRY(vm.argument(0).to_string(global_object));
auto filename = TRY(vm.argument(0).to_string(vm));
auto file = Core::File::construct(filename);
if (!file->open(Core::OpenMode::ReadOnly))
return vm.throw_completion<JS::Error>(String::formatted("Failed to open '{}': {}", filename, file->error_string()));
@ -1286,7 +1286,7 @@ static JS::ThrowCompletionOr<JS::Value> load_ini_impl(JS::VM& vm, JS::GlobalObje
static JS::ThrowCompletionOr<JS::Value> load_json_impl(JS::VM& vm, JS::GlobalObject& global_object)
{
auto filename = TRY(vm.argument(0).to_string(global_object));
auto filename = TRY(vm.argument(0).to_string(vm));
auto file = Core::File::construct(filename);
if (!file->open(Core::OpenMode::ReadOnly))
return vm.throw_completion<JS::Error>(String::formatted("Failed to open '{}': {}", filename, file->error_string()));
@ -1343,7 +1343,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::exit_interpreter)
{
if (!vm.argument_count())
exit(0);
exit(TRY(vm.argument(0).to_number(global_object)).as_double());
exit(TRY(vm.argument(0).to_number(vm)).as_double());
}
JS_DEFINE_NATIVE_FUNCTION(ReplObject::repl_help)
@ -1735,7 +1735,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!variable.is_object())
break;
auto const* object = MUST(variable.to_object(interpreter->global_object()));
auto const* object = MUST(variable.to_object(*g_vm));
auto const& shape = object->shape();
list_all_properties(shape, property_name);
break;