mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
LibJS: Add basic support for module code with top-level await
For now, we handle this by creating a synthetic async function to wrap the top-level module code. This allows us to piggyback on the async function driver wrapper mechanism.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 21:11:12 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a2c3db8367 Pull-request: https://github.com/SerenityOS/serenity/pull/22183 Reviewed-by: https://github.com/trflynn89 ✅
@@ -49,6 +49,9 @@ public:
|
||||
|
||||
void make_method(Object& home_object);
|
||||
|
||||
[[nodiscard]] bool is_module_wrapper() const { return m_is_module_wrapper; }
|
||||
void set_is_module_wrapper(bool b) { m_is_module_wrapper = b; }
|
||||
|
||||
Statement const& ecmascript_code() const { return m_ecmascript_code; }
|
||||
Vector<FunctionParameter> const& formal_parameters() const { return m_formal_parameters; }
|
||||
|
||||
@@ -153,6 +156,7 @@ private:
|
||||
HashTable<DeprecatedFlyString> m_parameter_names;
|
||||
Vector<FunctionDeclaration const&> m_functions_to_initialize;
|
||||
bool m_arguments_object_needed { false };
|
||||
bool m_is_module_wrapper { false };
|
||||
Vector<VariableNameToInitialize> m_var_names_to_initialize_binding;
|
||||
Vector<DeprecatedFlyString> m_function_names_to_initialize_binding;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user