MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ProcessREPL

Method ProcessREPL

src/openrct2/scripting/ScriptEngine.cpp:1205–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205void ScriptEngine::ProcessREPL()
1206{
1207 while (!_evalQueue.empty())
1208 {
1209 auto item = std::move(_evalQueue.front());
1210 _evalQueue.pop();
1211 auto promise = std::move(std::get<0>(item));
1212 auto command = std::move(std::get<1>(item));
1213
1214 JSValue res = JS_Eval(_replContext, command.c_str(), command.length(), "<repl>", JS_EVAL_TYPE_GLOBAL);
1215 if (JS_IsException(res))
1216 {
1217 JSValue exceptionVal = JS_GetException(_replContext);
1218 _console.WriteLineError(Stringify(_replContext, exceptionVal));
1219 JS_FreeValue(_replContext, exceptionVal);
1220 }
1221 else if (!JS_IsUndefined(res))
1222 {
1223 _console.WriteLine(Stringify(_replContext, res));
1224 }
1225 JS_FreeValue(_replContext, res);
1226
1227 // Signal the promise so caller can continue
1228 promise.set_value();
1229 }
1230}
1231
1232std::future<void> ScriptEngine::Eval(const std::string& s)
1233{

Callers

nothing calls this directly

Calls 4

WriteLineErrorMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45
WriteLineMethod · 0.45

Tested by

no test coverage detected