patch 8.2.2396: Vim9: no white space allowed before "->"
Problem: Vim9: no white space allowed before "->".
Solution: Allow for white space. (closes #7725)
diff --git a/src/eval.c b/src/eval.c
index 3e316bd..ebd2507 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3671,7 +3671,7 @@
/*
* Evaluate "->method()".
- * "*arg" points to the '-'.
+ * "*arg" points to "method".
* Returns FAIL or OK. "*arg" is advanced to after the ')'.
*/
static int
@@ -3686,8 +3686,6 @@
typval_T base = *rettv;
int ret;
- // Skip over the ->.
- *arg += 2;
rettv->v_type = VAR_UNKNOWN;
if (**arg == '{')
@@ -3735,7 +3733,7 @@
/*
* Evaluate "->method()".
- * "*arg" points to the '-'.
+ * "*arg" points to "method".
* Returns FAIL or OK. "*arg" is advanced to after the ')'.
*/
static int
@@ -3753,8 +3751,6 @@
int evaluate = evalarg != NULL
&& (evalarg->eval_flags & EVAL_EVALUATE);
- // Skip over the ->.
- *arg += 2;
rettv->v_type = VAR_UNKNOWN;
name = *arg;
@@ -5765,10 +5761,10 @@
}
else if (p[0] == '-' && p[1] == '>')
{
- *arg = p;
+ *arg = skipwhite(p + 2);
if (ret == OK)
{
- if (((*arg)[2] == '{' && !in_vim9script()) || (*arg)[2] == '(')
+ if ((**arg == '{' && !in_vim9script()) || **arg == '(')
// expr->{lambda}() or expr->(lambda)()
ret = eval_lambda(arg, rettv, evalarg, verbose);
else