summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/SourceTextModule.h
blob: ac3cba673fdc0173949afb306acb0283b9e6587e (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
/*
 * 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]]
};

}