mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
LibJS: Generate FFI header using cbindgen instead of hand-rolling
Replace the BytecodeFactory header with cbindgen. This will help ensure that types and enums and constants are kept in sync between the C++ and Rust code. It's also a step in exporting more Rust enums directly rather than relying on magic constants for switch statements. The FFI functions are now all placed in the JS::FFI namespace, which is the cause for all the churn in the scripting parts of LibJS and LibWeb.
This commit is contained in:
committed by
Andreas Kling
parent
c381cd7d68
commit
92e4c20ad5
Notes:
github-actions[bot]
2026-03-18 01:50:46 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/92e4c20ad5b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8476
@@ -12,10 +12,14 @@
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
|
||||
struct RustParsedProgram;
|
||||
|
||||
namespace JS {
|
||||
|
||||
namespace FFI {
|
||||
|
||||
struct ParsedProgram;
|
||||
|
||||
}
|
||||
|
||||
// 16.2.1.6 Source Text Module Records, https://tc39.es/ecma262/#sec-source-text-module-records
|
||||
class JS_API SourceTextModule final : public CyclicModule {
|
||||
GC_CELL(SourceTextModule, CyclicModule);
|
||||
@@ -25,7 +29,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);
|
||||
static Result<GC::Ref<SourceTextModule>, Vector<ParserError>> parse_from_pre_parsed(FFI::ParsedProgram* 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