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

Method add_stack_variable

editor/debugger/editor_debugger_inspector.cpp:373–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void EditorDebuggerInspector::add_stack_variable(const Array &p_array, int p_offset) {
374 DebuggerMarshalls::ScriptStackVariable var;
375 var.deserialize(p_array);
376 String n = var.name;
377 Variant v = var.value;
378
379 PropertyHint h = PROPERTY_HINT_NONE;
380 String hs;
381
382 if (var.var_type == Variant::OBJECT && v) {
383 v = Object::cast_to<EncodedObjectAsID>(v)->get_object_id();
384 h = PROPERTY_HINT_OBJECT_ID;
385 hs = "Object";
386 }
387 String type;
388 switch (var.type) {
389 case 0:
390 type = "Locals/";
391 break;
392 case 1:
393 type = "Members/";
394 break;
395 case 2:
396 type = "Globals/";
397 break;
398 case 3:
399 type = "Evaluated/";
400 break;
401 default:
402 type = "Unknown/";
403 }
404
405 PropertyInfo pinfo;
406 // Encode special characters to avoid issues with expressions in Evaluator.
407 // Dots are skipped by uri_encode(), but uri_decode() process them correctly when replaced with "%2E".
408 pinfo.name = type + n.uri_encode().replace(".", "%2E");
409 pinfo.type = v.get_type();
410 pinfo.hint = h;
411 pinfo.hint_string = hs;
412
413 if ((p_offset == -1) || variables->prop_list.is_empty()) {
414 variables->prop_list.push_back(pinfo);
415 } else {
416 List<PropertyInfo>::Element *current = variables->prop_list.front();
417 for (int i = 0; i < p_offset; i++) {
418 current = current->next();
419 }
420 variables->prop_list.insert_before(current, pinfo);
421 }
422 variables->prop_values[pinfo.name][0] = v;
423 variables->update();
424 edit(variables);
425}
426
427void EditorDebuggerInspector::clear_stack_variables() {
428 variables->clear();

Callers 2

_msg_stack_frame_varMethod · 0.80
add_valueMethod · 0.80

Calls 11

uri_encodeMethod · 0.80
insert_beforeMethod · 0.80
deserializeMethod · 0.45
get_object_idMethod · 0.45
replaceMethod · 0.45
get_typeMethod · 0.45
is_emptyMethod · 0.45
push_backMethod · 0.45
frontMethod · 0.45
nextMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected