forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuiltin_info.h
More file actions
57 lines (50 loc) · 1.85 KB
/
builtin_info.h
File metadata and controls
57 lines (50 loc) · 1.85 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef SRC_BUILTIN_INFO_H_
#define SRC_BUILTIN_INFO_H_
#include <cinttypes>
#include <string>
#include <unordered_map>
#include <vector>
// This file must not depend on node.h or other code that depends on
// the full Node.js implementation because it is used during the
// compilation of the Node.js implementation itself (especially js2c).
namespace node {
namespace builtins {
enum class BuiltinSourceType {
kBootstrapRealm, // internal/bootstrap/realm
kBootstrapScript, // internal/bootstrap/*
kPerContextScript, // internal/per_context/*
kMainScript, // internal/main/*
kFunction, // others
kSourceTextModule, // selected modules, ends with .mjs in source
};
struct BuiltinInfo {
// C++17 inline static
inline static const std::unordered_map<BuiltinSourceType,
std::vector<std::string>>
parameter_map{
{BuiltinSourceType::kBootstrapRealm,
{"process",
"getLinkedBinding",
"getInternalBinding",
"primordials"}},
{BuiltinSourceType::kBootstrapScript,
{"process", "require", "internalBinding", "primordials"}},
{BuiltinSourceType::kPerContextScript,
{"exports", "primordials", "privateSymbols", "perIsolateSymbols"}},
{BuiltinSourceType::kMainScript,
{"process", "require", "internalBinding", "primordials"}},
{BuiltinSourceType::kFunction,
{"exports",
"require",
"module",
"process",
"internalBinding",
"primordials"}},
};
};
std::string GetBuiltinSourceTypeName(BuiltinSourceType type);
BuiltinSourceType GetBuiltinSourceType(const std::string& id,
const std::string& filename);
} // namespace builtins
} // namespace node
#endif // SRC_BUILTIN_INFO_H_