forked from oven-sh/bun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBunCommonStrings.h
36 lines (26 loc) · 1.04 KB
/
BunCommonStrings.h
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
#pragma once
// clang-format off
#define BUN_COMMON_STRINGS_EACH_NAME(macro) \
macro(require) \
macro(resolve)
// clang-format on
#define BUN_COMMON_STRINGS_ACCESSOR_DEFINITION(name) \
JSC::JSString* name##String(JSC::JSGlobalObject* globalObject) \
{ \
return m_commonString_##name.getInitializedOnMainThread(globalObject); \
}
#define BUN_COMMON_STRINGS_LAZY_PROPERTY_DECLARATION(name) \
JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSString> m_commonString_##name;
namespace Bun {
class CommonStrings {
public:
BUN_COMMON_STRINGS_EACH_NAME(BUN_COMMON_STRINGS_ACCESSOR_DEFINITION)
void initialize();
template<typename Visitor>
void visit(Visitor& visitor);
private:
BUN_COMMON_STRINGS_EACH_NAME(BUN_COMMON_STRINGS_LAZY_PROPERTY_DECLARATION)
};
} // namespace Bun
#undef BUN_COMMON_STRINGS_ACCESSOR_DEFINITION
#undef BUN_COMMON_STRINGS_LAZY_PROPERTY_DECLARATION