summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_byte_codegen.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-09-01 16:01:39 -0300
committerGeorge Marques <george@gmarqu.es>2021-09-01 16:06:30 -0300
commit3d135880572ae863b4de250bc2da8edac701c020 (patch)
tree60a34c4a383c460547126d260a410625365f5419 /modules/gdscript/gdscript_byte_codegen.cpp
parenta160a95ea67455c80c55da8385220d5c75a0aa60 (diff)
downloadredot-engine-3d135880572ae863b4de250bc2da8edac701c020.tar.gz
GDScript: Fix loading of interdependent autoloads
Move the autoload resolution to runtime by loading it into the stack with an extra instruction. This allows an autoload to use another autoload singleton independent of load order.
Diffstat (limited to 'modules/gdscript/gdscript_byte_codegen.cpp')
-rw-r--r--modules/gdscript/gdscript_byte_codegen.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp
index 5958326315..a7da153f5e 100644
--- a/modules/gdscript/gdscript_byte_codegen.cpp
+++ b/modules/gdscript/gdscript_byte_codegen.cpp
@@ -864,6 +864,12 @@ void GDScriptByteCodeGenerator::write_assign_default_parameter(const Address &p_
function->default_arguments.push_back(opcodes.size());
}
+void GDScriptByteCodeGenerator::write_store_global(const Address &p_dst, int p_global_index) {
+ append(GDScriptFunction::OPCODE_STORE_GLOBAL, 1);
+ append(p_dst);
+ append(p_global_index);
+}
+
void GDScriptByteCodeGenerator::write_store_named_global(const Address &p_dst, const StringName &p_global) {
append(GDScriptFunction::OPCODE_STORE_NAMED_GLOBAL, 1);
append(p_dst);