MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_debug_value

Function gjs_debug_value

gjs/jsapi-util-string.cpp:605–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605std::string gjs_debug_value(JS::Value v) {
606 if (v.isNull())
607 return "null";
608 if (v.isUndefined())
609 return "undefined";
610 if (v.isInt32()) {
611 std::ostringstream out;
612 out << v.toInt32();
613 return out.str();
614 }
615 if (v.isDouble()) {
616 std::ostringstream out;
617 out << v.toDouble();
618 return out.str();
619 }
620 if (v.isBigInt())
621 return gjs_debug_bigint(v.toBigInt());
622 if (v.isString())
623 return gjs_debug_string(v.toString());
624 if (v.isSymbol())
625 return gjs_debug_symbol(v.toSymbol());
626 if (v.isObject())
627 return gjs_debug_object(&v.toObject());
628 if (v.isBoolean())
629 return (v.toBoolean() ? "true" : "false");
630 if (v.isMagic())
631 return "<magic>";
632 return "unexpected value";
633}
634
635std::string gjs_debug_id(jsid id) {
636 if (id.isString())

Calls 5

gjs_debug_bigintFunction · 0.85
gjs_debug_stringFunction · 0.85
gjs_debug_symbolFunction · 0.85
gjs_debug_objectFunction · 0.85
toStringMethod · 0.45

Tested by 1