diff src/vim9compile.c @ 19330:9c8b803fe598 v8.2.0223

patch 8.2.0223: some instructions not yet tested Commit: https://github.com/vim/vim/commit/5cab73f8cca46d831fb9337b176493da2a55ed5d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 6 19:25:19 2020 +0100 patch 8.2.0223: some instructions not yet tested Problem: Some instructions not yet tested. Solution: Disassemble more instructions. Move tests to a new file. Compile call to s:function().
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Feb 2020 19:30:08 +0100
parents e99e6d794597
children d6e8a9e80be4
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1686,49 +1686,60 @@ compile_call(char_u **arg, size_t varlen
     char_u	*p;
     int		argcount = argcount_init;
     char_u	namebuf[100];
+    char_u	fname_buf[FLEN_FIXED + 1];
+    char_u	*tofree = NULL;
+    int		error = FCERR_NONE;
     ufunc_T	*ufunc;
+    int		res = FAIL;
 
     if (varlen >= sizeof(namebuf))
     {
 	semsg(_("E1011: name too long: %s"), name);
 	return FAIL;
     }
-    vim_strncpy(namebuf, name, varlen);
+    vim_strncpy(namebuf, *arg, varlen);
+    name = fname_trans_sid(namebuf, fname_buf, &tofree, &error);
 
     *arg = skipwhite(*arg + varlen + 1);
     if (compile_arguments(arg, cctx, &argcount) == FAIL)
-	return FAIL;
-
-    if (ASCII_ISLOWER(*name))
+	goto theend;
+
+    if (ASCII_ISLOWER(*name) && name[1] != ':')
     {
 	int	    idx;
 
 	// builtin function
-	idx = find_internal_func(namebuf);
+	idx = find_internal_func(name);
 	if (idx >= 0)
-	    return generate_BCALL(cctx, idx, argcount);
+	{
+	    res = generate_BCALL(cctx, idx, argcount);
+	    goto theend;
+	}
 	semsg(_(e_unknownfunc), namebuf);
     }
 
-    // User defined function or variable must start with upper case.
-    if (!ASCII_ISUPPER(*name))
-    {
-	semsg(_("E1012: Invalid function name: %s"), namebuf);
-	return FAIL;
-    }
-
     // If we can find the function by name generate the right call.
-    ufunc = find_func(namebuf, cctx);
+    ufunc = find_func(name, cctx);
     if (ufunc != NULL)
-	return generate_CALL(cctx, ufunc, argcount);
+    {
+	res = generate_CALL(cctx, ufunc, argcount);
+	goto theend;
+    }
 
     // If the name is a variable, load it and use PCALL.
     p = namebuf;
     if (compile_load(&p, namebuf + varlen, cctx, FALSE) == OK)
-	return generate_PCALL(cctx, argcount, FALSE);
+    {
+	res = generate_PCALL(cctx, argcount, FALSE);
+	goto theend;
+    }
 
     // The function may be defined only later.  Need to figure out at runtime.
-    return generate_UCALL(cctx, namebuf, argcount);
+    res = generate_UCALL(cctx, name, argcount);
+
+theend:
+    vim_free(tofree);
+    return res;
 }
 
 // like NAMESPACE_CHAR but with 'a' and 'l'.