MCPcopy Create free account
hub / github.com/Snapchat/Valdi / tsn_debug

Function tsn_debug

tsn/src/tsn/tsn.cpp:383–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void 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
410struct Timer {
411 int64_t id;

Callers

nothing calls this directly

Calls 7

tsn_is_exceptionFunction · 0.85
tsn_dump_errorFunction · 0.85
tsn_undefinedFunction · 0.85
JS_FreeValueFunction · 0.85
tsn_printFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected