diff src/vim9execute.c @ 33951:45a50fd59a73 v9.0.2170

patch 9.0.2170: Vim9: no support for const/final class/objects vars Commit: https://github.com/vim/vim/commit/e5437c542709b77ade084f96e60d84d4e847e6d3 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Dec 16 14:11:19 2023 +0100 patch 9.0.2170: Vim9: no support for const/final class/objects vars Problem: Vim9: no support for const/final class/objects vars Solution: Support final and const object and class variables closes: #13655 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Dec 2023 14:15:05 +0100
parents bdd408288d95
children ab6a70fad5b5
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -4455,7 +4455,11 @@ exec_instructions(ectx_T *ectx)
 		else
 		{
 		    *tv = *STACK_TV_VAR(0);
-		    ++tv->vval.v_object->obj_refcount;
+		    object_T *obj = tv->vval.v_object;
+		    ++obj->obj_refcount;
+
+		    // Lock all the constant object variables
+		    obj_lock_const_vars(obj);
 		}
 		// FALLTHROUGH