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

LibJS: Replace GlobalObject with VM in common AOs [Part 18/19]

This commit is contained in:
Linus Groh 2022-08-21 19:24:32 +01:00
parent 7856886ed5
commit 25849f8a6d
95 changed files with 536 additions and 677 deletions

View file

@ -145,11 +145,13 @@ NonnullRefPtr<SyntheticModule> SyntheticModule::create_default_export_synthetic_
// 1.4 ParseJSONModule ( source ), https://tc39.es/proposal-json-modules/#sec-parse-json-module
ThrowCompletionOr<NonnullRefPtr<Module>> parse_json_module(StringView source_text, Realm& realm, StringView filename)
{
auto& vm = realm.vm();
// 1. Let jsonParse be realm's intrinsic object named "%JSON.parse%".
auto* json_parse = realm.global_object().json_parse_function();
// 2. Let json be ? Call(jsonParse, undefined, « sourceText »).
auto json = TRY(call(realm.global_object(), *json_parse, js_undefined(), js_string(realm.vm(), source_text)));
auto json = TRY(call(vm, *json_parse, js_undefined(), js_string(realm.vm(), source_text)));
// 3. Return CreateDefaultExportSyntheticModule(json, realm, hostDefined).
return SyntheticModule::create_default_export_synthetic_module(json, realm, filename);