diff options
author | George Marques <george@gmarqu.es> | 2022-06-27 12:09:51 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2022-06-27 12:09:51 -0300 |
commit | 511a4b761c3b5bf565f6e580fc9774a99e72a53e (patch) | |
tree | 83506363302f698270b87d75edd7e5b9b91a4730 /modules/gdscript/gdscript_byte_codegen.h | |
parent | 307dfa9fe960c93b3f4c2f78d9c046c1ffff6a93 (diff) | |
download | redot-engine-511a4b761c3b5bf565f6e580fc9774a99e72a53e.tar.gz |
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.
Diffstat (limited to 'modules/gdscript/gdscript_byte_codegen.h')
-rw-r--r-- | modules/gdscript/gdscript_byte_codegen.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index 6ee8fda533..f4b402fc96 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -479,6 +479,8 @@ public: virtual void write_if(const Address &p_condition) override; virtual void write_else() override; virtual void write_endif() override; + virtual void write_jump_if_shared(const Address &p_value) override; + virtual void write_end_jump_if_shared() override; virtual void start_for(const GDScriptDataType &p_iterator_type, const GDScriptDataType &p_list_type) override; virtual void write_for_assignment(const Address &p_variable, const Address &p_list) override; virtual void write_for() override; |