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.
This commit is contained in:
George Marques 2021-09-01 16:01:39 -03:00
parent a160a95ea6
commit 3d13588057
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
7 changed files with 46 additions and 3 deletions

View file

@ -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);