blob: c318e721f52bdeba0b5beca8fed9a9f4a54375d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* 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();
Program const& parse_node() const { return *m_ecmascript_code; }
private:
explicit SourceTextModule(Realm&, NonnullRefPtr<Program>);
NonnullRefPtr<Program> m_ecmascript_code; // [[ECMAScriptCode]]
};
}
|