patch 8.2.5026: Vim9: a few lines not covered by tests
Problem: Vim9: a few lines not covered by tests.
Solution: Delete dead code. Add a few test cases. make "12->func()" work.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6cf7715..048c224 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3507,6 +3507,18 @@
}
/*
+ * Return TRUE if "cmd" starts with "123->", a number followed by a method
+ * call.
+ */
+ int
+number_method(char_u *cmd)
+{
+ char_u *p = skipdigits(cmd);
+
+ return p > cmd && (p = skipwhite(p))[0] == '-' && p[1] == '>';
+}
+
+/*
* Find an Ex command by its name, either built-in or user.
* Start of the name can be found at eap->cmd.
* Sets eap->cmdidx and returns a pointer to char after the command name.
@@ -3716,6 +3728,13 @@
}
}
+ // 1234->func() is a method call
+ if (number_method(eap->cmd))
+ {
+ eap->cmdidx = CMD_eval;
+ return eap->cmd;
+ }
+
// "g:", "s:" and "l:" are always assumed to be a variable, thus start
// an expression. A global/substitute/list command needs to use a
// longer name.