| 371 | } |
| 372 | |
| 373 | void 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 | |
| 427 | void EditorDebuggerInspector::clear_stack_variables() { |
| 428 | variables->clear(); |
no test coverage detected