1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00

LibJS: Add a barebones SourceTextModule class

This corresponds to "Source Text Module Record" from the spec.
This commit is contained in:
Andreas Kling 2021-09-14 20:51:16 +02:00
parent 405b8e7915
commit 5fa02b8a9e
Notes: sideshowbarker 2024-07-18 03:58:02 +09:00
3 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/AST.h>
#include <LibJS/Forward.h>
#include <LibJS/Module.h>
#include <LibJS/Parser.h>
namespace JS {
// 16.2.1.6 Source Text Module Records, https://tc39.es/ecma262/#sec-source-text-module-records
class SourceTextModule final : public Module {
public:
static Result<NonnullRefPtr<SourceTextModule>, Vector<Parser::Error>> parse(StringView source_text, Realm&, StringView filename = {});
virtual ~SourceTextModule();
private:
explicit SourceTextModule(Realm&, NonnullRefPtr<Program>);
NonnullRefPtr<Program> m_ecmascript_code; // [[ECMAScriptCode]]
};
}