Fix null values for local const in debugger

This commit is contained in:
scrawach 2026-01-31 23:19:26 +03:00
parent 89cea14398
commit f45bf82ae7
3 changed files with 10 additions and 1 deletions

View file

@ -200,6 +200,9 @@ GDScriptFunction *GDScriptByteCodeGenerator::write_end() {
for (const KeyValue<Variant, int> &K : constant_map) {
function->constants.write[K.value] = K.key;
}
for (const KeyValue<StringName, int> &K : local_constants) {
function->constant_map.insert(K.key, function->constants[K.value]);
}
} else {
function->_constants_ptr = nullptr;
function->_constant_count = 0;

View file

@ -345,7 +345,12 @@ void GDScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p
f->debug_get_stack_member_state(*cl->line, &locals);
for (const Pair<StringName, int> &E : locals) {
p_locals->push_back(E.first);
p_values->push_back(cl->stack[E.second]);
if (f->constant_map.has(E.first)) {
p_values->push_back(f->constant_map[E.first]);
} else {
p_values->push_back(cl->stack[E.second]);
}
}
}

View file

@ -479,6 +479,7 @@ private:
Vector<int> code;
Vector<int> default_arguments;
Vector<Variant> constants;
HashMap<StringName, Variant> constant_map;
Vector<StringName> global_names;
Vector<Variant::ValidatedOperatorEvaluator> operator_funcs;
Vector<Variant::ValidatedSetter> setters;