| 247 | } |
| 248 | |
| 249 | static void callFunc(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 250 | auto isolate = args.GetIsolate(); |
| 251 | v8::HandleScope handle_scope(isolate); |
| 252 | auto data = args.Data().As<v8::External>(); |
| 253 | auto& func = *reinterpret_cast<script::Function*>(data->Value()); |
| 254 | |
| 255 | for (int i = 0; i < args.Length(); i++) { |
| 256 | func.arguments.push_back(getValue(isolate, args[i])); |
| 257 | } |
| 258 | |
| 259 | func.result.makeUndefined(); |
| 260 | |
| 261 | try { |
| 262 | func(); |
| 263 | } catch (const ObjectDestroyedException&) { |
| 264 | std::cout << "Object Destroyed Exception" << std::endl; |
| 265 | } |
| 266 | args.GetReturnValue().Set(returnValue(isolate, func.result)); |
| 267 | } |
| 268 | |
| 269 | void pushFunctions(v8::Local<v8::Object>& object) { |
| 270 | auto isolate = m_engine.get<V8Engine>()->m_isolate; |
nothing calls this directly
no test coverage detected