| 460 | // Invoke |
| 461 | template <typename... ArgsT> |
| 462 | static var invoke(const var &func, ArgsT &&..._args) |
| 463 | { |
| 464 | if (func.is_type_of<callable>()) { |
| 465 | vector args{std::forward<ArgsT>(_args)...}; |
| 466 | return func.const_val<callable>().call(args); |
| 467 | } |
| 468 | else if (func.is_type_of<object_method>()) { |
| 469 | const auto &om = func.const_val<object_method>(); |
| 470 | vector args{om.object, std::forward<ArgsT>(_args)...}; |
| 471 | return om.callable.const_val<callable>().call(args); |
| 472 | } |
| 473 | else |
| 474 | throw runtime_error("Invoke non-callable object."); |
| 475 | } |
| 476 | |
| 477 | // Type and struct |
| 478 | struct pointer final { |
no test coverage detected