Adds caching for expensive type resolution.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-09-22 19:02:01 +02:00
parent 7e9e574577
commit e5ea2bbc90
22 changed files with 124 additions and 42 deletions

View File

@@ -1,12 +1,13 @@
#ifndef PKMNLIB_ANGELSCRIPTFUNCTIONCALL_HPP
#define PKMNLIB_ANGELSCRIPTFUNCTIONCALL_HPP
#include "AngelScriptResolver.hpp"
#include "ContextPool.hpp"
class AngelScriptUtils {
public:
static void AngelscriptFunctionCall(asIScriptFunction* func, ContextPool* ctxPool, asIScriptObject* obj,
const ArbUt::StringView& scriptName,
AngelScriptResolver* resolver, const ArbUt::StringView& scriptName,
const std::function<void(asIScriptContext*)>& setup,
const std::function<void(asIScriptContext*)>& onEnd) {
auto ctx = asGetActiveContext();
@@ -17,6 +18,9 @@ public:
} else {
ctx->PushState();
}
if (ctx->GetUserData() == nullptr) {
ctx->SetUserData(resolver->GetUserdata());
}
ctx->Prepare(func);
ctx->SetObject(obj);
setup(ctx);