MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _get_variant_string

Function _get_variant_string

modules/gdscript/gdscript_disassembler.cpp:46–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44#include "core/string/string_builder.h"
45
46static String _get_variant_string(const Variant &p_variant) {
47 String txt;
48 if (p_variant.get_type() == Variant::STRING) {
49 txt = "\"" + String(p_variant) + "\"";
50 } else if (p_variant.get_type() == Variant::STRING_NAME) {
51 txt = "&\"" + String(p_variant) + "\"";
52 } else if (p_variant.get_type() == Variant::NODE_PATH) {
53 txt = "^\"" + String(p_variant) + "\"";
54 } else if (p_variant.get_type() == Variant::OBJECT) {
55 Object *obj = p_variant;
56 if (!obj) {
57 txt = "null";
58 } else {
59 GDScriptNativeClass *cls = Object::cast_to<GDScriptNativeClass>(obj);
60 if (cls) {
61 txt = "class(" + cls->get_name() + ")";
62 } else {
63 Script *script = Object::cast_to<Script>(obj);
64 if (script) {
65 txt = "script(" + GDScript::debug_get_script_name(script) + ")";
66 } else {
67 txt = "object(" + obj->get_class();
68 if (obj->get_script_instance()) {
69 txt += ", " + GDScript::debug_get_script_name(obj->get_script_instance()->get_script());
70 }
71 txt += ")";
72 }
73 }
74 }
75 } else {
76 txt = p_variant;
77 }
78 return txt;
79}
80
81static String _disassemble_address(const GDScript *p_script, const GDScriptFunction &p_function, int p_address) {
82 int addr = p_address & GDScriptFunction::ADDR_MASK;

Callers 1

_disassemble_addressFunction · 0.85

Calls 6

get_script_instanceMethod · 0.80
StringClass · 0.50
get_typeMethod · 0.45
get_nameMethod · 0.45
get_classMethod · 0.45
get_scriptMethod · 0.45

Tested by

no test coverage detected