summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-26 22:24:43 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-26 22:24:43 +0100
commit31d9948e3a2529c2f619d56bdb48291dc261233d (patch)
tree9d190d121b8851b0d861455ba61b09fd03da8776 /src/ex_docmd.c
parent5cb53b7afe6bde8f2bf6fc6b65b86071b67a8554 (diff)
patch 8.2.5026: Vim9: a few lines not covered by testsv8.2.5026
Problem: Vim9: a few lines not covered by tests. Solution: Delete dead code. Add a few test cases. make "12->func()" work.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6cf77155ca..048c224362 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3507,6 +3507,18 @@ one_letter_cmd(char_u *p, cmdidx_T *idx)
}
/*
+ * 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 @@ find_ex_command(
}
}
+ // 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.