1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibJS+LibWeb: Move JS::ModuleRequest to its own header file

This allows us to not include LibJS/AST.h in a couple more places.
This commit is contained in:
Andreas Kling 2022-11-23 14:18:38 +01:00 committed by Linus Groh
parent 38c7fdaac1
commit 3503c658fb
7 changed files with 47 additions and 29 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2021-2022, David Tuin <davidot@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/FlyString.h>
#include <AK/Vector.h>
namespace JS {
// 2.9 ModuleRequest Records, https://tc39.es/proposal-import-assertions/#sec-modulerequest-record
struct ModuleRequest {
struct Assertion {
String key;
String value;
};
ModuleRequest() = default;
explicit ModuleRequest(FlyString specifier)
: module_specifier(move(specifier))
{
}
ModuleRequest(FlyString module_specifier, Vector<Assertion> assertions);
void add_assertion(String key, String value)
{
assertions.empend(move(key), move(value));
}
FlyString module_specifier; // [[Specifier]]
Vector<Assertion> assertions; // [[Assertions]]
};
}