diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index feb40bb584d..2961a67e053 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -200,6 +200,9 @@ GDScriptFunction *GDScriptByteCodeGenerator::write_end() { for (const KeyValue &K : constant_map) { function->constants.write[K.value] = K.key; } + for (const KeyValue &K : local_constants) { + function->constant_map.insert(K.key, function->constants[K.value]); + } } else { function->_constants_ptr = nullptr; function->_constant_count = 0; diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index ad8e8afb3c1..e3d81f7b544 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -345,7 +345,12 @@ void GDScriptLanguage::debug_get_stack_level_locals(int p_level, List *p f->debug_get_stack_member_state(*cl->line, &locals); for (const Pair &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]); + } } } diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 664ac2a0166..fe965bb223a 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -479,6 +479,7 @@ private: Vector code; Vector default_arguments; Vector constants; + HashMap constant_map; Vector global_names; Vector operator_funcs; Vector setters;