diff src/vim9script.c @ 19511:7e76d5fba19f v8.2.0313

patch 8.2.0313: Vim9: insufficient script tests Commit: https://github.com/vim/vim/commit/fa29c8abd62c2733d5505563600ea35dddf73dca Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 23 22:35:05 2020 +0100 patch 8.2.0313: Vim9: insufficient script tests Problem: Vim9: insufficient script tests. Solution: Add tests. Make import of alphanumeric name work.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Feb 2020 22:45:04 +0100
parents 17f0d6dc6a73
children 2fee087c94cb
line wrap: on
line diff
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -172,7 +172,7 @@ find_exported(
     scriptitem_T *script = SCRIPT_ITEM(sid);
 
     // isolate one name
-    while (eval_isnamec1(*arg))
+    while (eval_isnamec(*arg))
 	++arg;
     *name_len = (int)(arg - name);
 
@@ -262,9 +262,9 @@ handle_import(char_u *arg_start, garray_
     {
 	if (*arg == '*')
 	    arg = skipwhite(arg + 1);
-	else
+	else if (eval_isnamec1(*arg))
 	{
-	    while (eval_isnamec1(*arg))
+	    while (eval_isnamec(*arg))
 		++arg;
 	    arg = skipwhite(arg);
 	}
@@ -273,8 +273,9 @@ handle_import(char_u *arg_start, garray_
 	    // skip over "as Name "
 	    arg = skipwhite(arg + 2);
 	    as_ptr = arg;
-	    while (eval_isnamec1(*arg))
-		++arg;
+	    if (eval_isnamec1(*arg))
+		while (eval_isnamec(*arg))
+		    ++arg;
 	    as_len = (int)(arg - as_ptr);
 	    arg = skipwhite(arg);
 	}
@@ -286,7 +287,7 @@ handle_import(char_u *arg_start, garray_
     }
     if (STRNCMP("from", arg, 4) != 0 || !VIM_ISWHITE(arg[4]))
     {
-	emsg(_("E1045: Missing \"from\""));
+	emsg(_("E1070: Missing \"from\""));
 	return NULL;
     }
     from_ptr = arg;
@@ -299,7 +300,7 @@ handle_import(char_u *arg_start, garray_
 	ret = get_string_tv(&arg, &tv, TRUE);
     if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
     {
-	emsg(_("E1045: Invalid string after \"from\""));
+	emsg(_("E1071: Invalid string after \"from\""));
 	return NULL;
     }
     cmd_end = arg;
@@ -423,6 +424,7 @@ handle_import(char_u *arg_start, garray_
 	}
 	if (arg != from_ptr)
 	{
+	    // cannot happen, just in case the above has a flaw
 	    emsg(_("E1047: syntax error in import"));
 	    return NULL;
 	}