General fixes for ScriptOptions

This commit is contained in:
Deukhoofd 2019-08-24 16:11:09 +02:00
parent e913f8d052
commit df755fcdd3
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 5 additions and 4 deletions

View File

@ -92,6 +92,7 @@ const EvalValue* Porygon::Script::CallFunction(const u16string &key, const vecto
Porygon::Script *Porygon::Script::Clone(const Porygon::Script *script) {
auto s = new Script(script->_boundScript, script->Diagnostics);
s->_scriptOptions = script ->_scriptOptions;
for (const auto& v: *script->_scriptVariables){
s->_scriptVariables->insert({v.first, nullptr});
}
@ -115,8 +116,8 @@ Porygon::Script::Script(shared_ptr<BoundScriptStatement> boundScript,
}
extern "C" {
Porygon::Script* CreateScript(char16_t * s){
return Porygon::Script::Create(s);
Porygon::Script* CreateScript(char16_t * s, Porygon::ScriptOptions* options){
return Porygon::Script::Create(s, options);
}
Porygon::Script* CloneScript(Porygon::Script* p){

View File

@ -52,7 +52,7 @@ extern "C"{
opt->SetModuleExistsFunc(func);
}
void SetOptionResolveModuleFunc(Porygon::ScriptOptions* opt, bool (*func)(const std::string& moduleName)){
opt->SetModuleExistsFunc(func);
void SetOptionResolveModuleFunc(Porygon::ScriptOptions* opt, Porygon::Script* (*func)(const std::string& moduleName)){
opt->SetResolveModuleFunc(func);
}
}