| 381 | } |
| 382 | |
| 383 | void tsn_debug(tsn_vm* ctx, tsn_value_const value, const char* expression) { |
| 384 | std::string script = "(($input) => "; |
| 385 | script += std::string_view(expression); |
| 386 | script += ")"; |
| 387 | |
| 388 | auto fn = JS_Eval(ctx, script.data(), script.size(), "debug.json", 0); |
| 389 | if (tsn_is_exception(ctx, fn)) { |
| 390 | tsn_dump_error(ctx); |
| 391 | return; |
| 392 | } |
| 393 | |
| 394 | auto retValue = JS_CallInternal_tsn(ctx, fn, tsn_undefined(ctx), tsn_undefined(ctx), 1, (tsn_value[]){value}, 0); |
| 395 | JS_FreeValue(ctx, fn); |
| 396 | |
| 397 | if (tsn_is_exception(ctx, retValue)) { |
| 398 | tsn_dump_error(ctx); |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | auto print_result = tsn_print(ctx, tsn_undefined(ctx), 1, (tsn_value[]){retValue}); |
| 403 | if (tsn_is_exception(ctx, print_result)) { |
| 404 | tsn_dump_error(ctx); |
| 405 | } |
| 406 | |
| 407 | JS_FreeValue(ctx, retValue); |
| 408 | } |
| 409 | |
| 410 | struct Timer { |
| 411 | int64_t id; |
nothing calls this directly
no test coverage detected