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>
diff --git a/src/eval.c b/src/eval.c
index 0579a85..877a20f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1778,6 +1778,13 @@
p, flags) == FAIL)
return NULL;
+ // When lhs is used to modify the variable, check it is
+ // not a read-only variable.
+ if ((flags & GLV_READ_ONLY) == 0
+ && (*p != '.' && *p != '[')
+ && oc_var_check_ro(cl, om))
+ return NULL;
+
lp->ll_valtype = om->ocm_type;
if (v_type == VAR_OBJECT)