You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
GDScript: Fix setter being called in chains for shared types
When a type is shared (i.e. passed by reference) it doesn't need to be called in a setter chain (e.g. `a.b.c = 0`) since it will be updated in place. This commit adds an instruction that jumps when the value is shared so it can be used to skip those cases and avoid redundant calls of setters. It also solves issues when assigning to sub-properties of read-only properties.
This commit is contained in:
@@ -838,6 +838,14 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
||||
|
||||
incr = 1;
|
||||
} break;
|
||||
case OPCODE_JUMP_IF_SHARED: {
|
||||
text += "jump-if-shared ";
|
||||
text += DADDR(1);
|
||||
text += " to ";
|
||||
text += itos(_code_ptr[ip + 2]);
|
||||
|
||||
incr = 3;
|
||||
} break;
|
||||
case OPCODE_RETURN: {
|
||||
text += "return ";
|
||||
text += DADDR(1);
|
||||
|
||||
Reference in New Issue
Block a user