summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-10 18:42:12 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-10 18:42:12 +0000
commit7ce7daf6cd6a7ed27eac060699026640b4b239a8 (patch)
treebb6ddd44c1e6133c82ce791d9568405723f251af /src/eval.c
parent6c87bbb4e45515e70ac1728cabd1451063bf427d (diff)
patch 9.0.1045: in a class object members cannot be initializedv9.0.1045
Problem: In a class object members cannot be initialized. Solution: Support initializing object members. Make "dissassemble" work on an object method.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c
index 0a0a1e11d6..b19cd94835 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1193,9 +1193,8 @@ get_lval(
var2.v_type = VAR_UNKNOWN;
while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
{
- int r = OK;
-
- if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
+ if (*p == '.' && lp->ll_tv->v_type != VAR_DICT
+ && lp->ll_tv->v_type != VAR_CLASS)
{
if (!quiet)
semsg(_(e_dot_can_only_be_used_on_dictionary_str), name);
@@ -1203,7 +1202,8 @@ get_lval(
}
if (lp->ll_tv->v_type != VAR_LIST
&& lp->ll_tv->v_type != VAR_DICT
- && lp->ll_tv->v_type != VAR_BLOB)
+ && lp->ll_tv->v_type != VAR_BLOB
+ && lp->ll_tv->v_type != VAR_CLASS)
{
if (!quiet)
emsg(_(e_can_only_index_list_dictionary_or_blob));
@@ -1211,6 +1211,7 @@ get_lval(
}
// A NULL list/blob works like an empty list/blob, allocate one now.
+ int r = OK;
if (lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list == NULL)
r = rettv_list_alloc(lp->ll_tv);
else if (lp->ll_tv->v_type == VAR_BLOB
@@ -1463,7 +1464,7 @@ get_lval(
lp->ll_tv = NULL;
break;
}
- else
+ else if (lp->ll_tv->v_type == VAR_LIST)
{
/*
* Get the number and item for the only or first index of the List.
@@ -1508,6 +1509,11 @@ get_lval(
lp->ll_tv = &lp->ll_li->li_tv;
}
+ else // v_type == VAR_CLASS
+ {
+ // TODO: check object members and methods if
+ // "key" points name start, "p" to the end
+ }
}
clear_tv(&var1);