diff options
author | George Marques <george@gmarqu.es> | 2020-10-19 20:21:14 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 20:21:14 -0300 |
commit | 5ddfc657abc4861b8102dc5c2a826d7f587c32e9 (patch) | |
tree | 449d160754339773d381de6e0ba2bfc066ce7d4b | |
parent | 84e900830afc13c8a3f9d48b0df658cdcfb77003 (diff) | |
parent | 119936d9390a898901907bf3495d51d98cc82b07 (diff) |
Merge pull request #42067 from ThakeeNathees/for-loop-stack-overriden-fix
GDScript: for loop override stack variable bug fix
-rw-r--r-- | modules/gdscript/gdscript_byte_codegen.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index eabf53581d..cc9e87b882 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -580,8 +580,8 @@ void GDScriptByteCodeGenerator::write_endif() { } void GDScriptByteCodeGenerator::write_for(const Address &p_variable, const Address &p_list) { - int counter_pos = increase_stack() | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); - int container_pos = increase_stack() | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + int counter_pos = add_temporary() | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + int container_pos = add_temporary() | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); current_breaks_to_patch.push_back(List<int>()); @@ -629,7 +629,9 @@ void GDScriptByteCodeGenerator::write_endfor() { } current_breaks_to_patch.pop_back(); - current_stack_size -= 2; // Remove loop temporaries. + // Remove loop temporaries. + pop_temporary(); + pop_temporary(); } void GDScriptByteCodeGenerator::start_while_condition() { |