enhance factory method of luajit::Context

This commit is contained in:
falsycat 2023-09-24 16:38:26 +09:00
parent b279b02327
commit 117b117dfa
3 changed files with 9 additions and 3 deletions

View File

@ -159,7 +159,7 @@ class AsyncContext final :
};
} // namespace
std::shared_ptr<Context> Context::Create(Env& env, Kind kind) {
std::shared_ptr<Context> Context::Make(Env& env, Kind kind) {
switch (kind) {
case kSync:
return std::make_shared<SyncContext>(env);

View File

@ -147,7 +147,13 @@ class Context :
kSync,
kAsync,
};
static std::shared_ptr<Context> Create(Env&, Kind);
static std::shared_ptr<Context> Make(Env&, Kind);
static std::shared_ptr<Context> MakeAsync(Env& env) {
return Make(env, kAsync);
}
static std::shared_ptr<Context> MakeSync(Env& env) {
return Make(env, kSync);
}
explicit Context(const char* name, Kind kind)
: subsys::Interface(name), kind_(kind), state_(nullptr) {

View File

@ -30,7 +30,7 @@ class ContextFixture :
: EnvFixtureWithTasking({
{
typeid(Context), [](auto& env) {
return Context::Create(env, GetParam());
return Context::Make(env, GetParam());
},
},
}) { }