1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

LibJS: Add support for JSON modules

We now have one supported assertion: 'type' if that is 'json' we attempt
to parse the module as JSON.
This commit is contained in:
davidot 2022-01-27 14:51:21 +01:00 committed by Linus Groh
parent 202de6ed25
commit 6b5c882af3
8 changed files with 277 additions and 24 deletions

View file

@ -24,11 +24,7 @@ Module::~Module()
// 16.2.1.5.1.1 InnerModuleLinking ( module, stack, index ), https://tc39.es/ecma262/#sec-InnerModuleLinking
ThrowCompletionOr<u32> Module::inner_module_linking(VM& vm, Vector<Module*>&, u32 index)
{
// Note: Until we have something extending module which is not SourceTextModule we crash.
VERIFY_NOT_REACHED();
// 1. If module is not a Cyclic Module Record, then
// a. Perform ? module.Link().
TRY(link(vm));
// b. Return index.
@ -38,9 +34,6 @@ ThrowCompletionOr<u32> Module::inner_module_linking(VM& vm, Vector<Module*>&, u3
// 16.2.1.5.2.1 InnerModuleEvaluation ( module, stack, index ), https://tc39.es/ecma262/#sec-innermoduleevaluation
ThrowCompletionOr<u32> Module::inner_module_evaluation(VM& vm, Vector<Module*>&, u32 index)
{
// Note: Until we have something extending module which is not SourceTextModule we crash.
VERIFY_NOT_REACHED();
// 1. If module is not a Cyclic Module Record, then
// a. Let promise be ! module.Evaluate().
auto* promise = TRY(evaluate(vm));