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 /core/variant/variant.h | |
parent | 307dfa9fe960c93b3f4c2f78d9c046c1ffff6a93 (diff) |
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 'core/variant/variant.h')
-rw-r--r-- | core/variant/variant.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h index 992d9cad40..cb3a622417 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -297,6 +297,7 @@ public: static String get_type_name(Variant::Type p_type); static bool can_convert(Type p_type_from, Type p_type_to); static bool can_convert_strict(Type p_type_from, Type p_type_to); + static bool is_type_shared(Variant::Type p_type); bool is_ref_counted() const; _FORCE_INLINE_ bool is_num() const { |