mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibJS+LibWeb: Add C++ compile_parsed_module wrapper
Add compile_parsed_module() to RustIntegration, which takes a RustParsedProgram and a SourceCode (from parse_program with ProgramType::Module) and compiles it on the main thread with GC interaction. Rewrite compile_module() to use the new split functions internally. Add SourceTextModule::parse_from_pre_parsed() and JavaScriptModuleScript::create_from_pre_parsed() to allow creating module scripts from a pre-parsed RustParsedProgram. This prepares the infrastructure for off-thread module parsing.
This commit is contained in:
committed by
Andreas Kling
parent
7d45e897c4
commit
3f4d3d6108
Notes:
github-actions[bot]
2026-03-06 12:07:29 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/3f4d3d61080 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8211 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/alimpfard
@@ -12,6 +12,8 @@
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
|
||||
struct RustParsedProgram;
|
||||
|
||||
namespace JS {
|
||||
|
||||
// 16.2.1.6 Source Text Module Records, https://tc39.es/ecma262/#sec-source-text-module-records
|
||||
@@ -23,6 +25,7 @@ public:
|
||||
virtual ~SourceTextModule() override;
|
||||
|
||||
static Result<GC::Ref<SourceTextModule>, Vector<ParserError>> parse(StringView source_text, Realm&, StringView filename = {}, Script::HostDefined* host_defined = nullptr);
|
||||
static Result<GC::Ref<SourceTextModule>, Vector<ParserError>> parse_from_pre_parsed(RustParsedProgram* parsed, NonnullRefPtr<SourceCode const> source_code, Realm&, Script::HostDefined* host_defined = nullptr);
|
||||
|
||||
Program const* parse_node() const { return m_ecmascript_code; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user