• R/O
  • SSH

vim: コミット

Mirror of the Vim source from https://github.com/vim/vim


コミットメタ情報

リビジョン7028f45bf0ea13f63ad72a27aa03def48450616b (tree)
日時2020-08-02 05:45:03
作者Bram Moolenaar <Bram@vim....>
コミッターBram Moolenaar

ログメッセージ

patch 8.2.1351: Vim9: no proper error if using namespace for nested function

Commit: https://github.com/vim/vim/commit/bcbf41395f93aabd577a17dc4fbabe523d0a7ce8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 1 22:35:13 2020 +0200

patch 8.2.1351: Vim9: no proper error if using namespace for nested function
Problem: Vim9: no proper error if using namespace for nested function.
Solution: Specifically check for a namespace. (closes https://github.com/vim/vim/issues/6582)

変更サマリ

差分

diff -r 4f4faadeaa2a -r 7028f45bf0ea src/testdir/test_vim9_func.vim
--- a/src/testdir/test_vim9_func.vim Sat Aug 01 22:30:05 2020 +0200
+++ b/src/testdir/test_vim9_func.vim Sat Aug 01 22:45:03 2020 +0200
@@ -131,6 +131,8 @@
131131 CheckDefFailure(['def Nested(arg: string)', 'enddef', 'Nested()'], 'E119:')
132132
133133 CheckDefFailure(['func Nested()', 'endfunc'], 'E1086:')
134+ CheckDefFailure(['def s:Nested()', 'enddef'], 'E1075:')
135+ CheckDefFailure(['def b:Nested()', 'enddef'], 'E1075:')
134136 enddef
135137
136138 func Test_call_default_args_from_func()
diff -r 4f4faadeaa2a -r 7028f45bf0ea src/version.c
--- a/src/version.c Sat Aug 01 22:30:05 2020 +0200
+++ b/src/version.c Sat Aug 01 22:45:03 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1351,
759+/**/
758760 1350,
759761 /**/
760762 1349,
diff -r 4f4faadeaa2a -r 7028f45bf0ea src/vim9compile.c
--- a/src/vim9compile.c Sat Aug 01 22:30:05 2020 +0200
+++ b/src/vim9compile.c Sat Aug 01 22:45:03 2020 +0200
@@ -4899,12 +4899,18 @@
48994899 {
49004900 int is_global = *eap->arg == 'g' && eap->arg[1] == ':';
49014901 char_u *name_start = eap->arg;
4902- char_u *name_end = to_name_end(eap->arg, is_global);
4902+ char_u *name_end = to_name_end(eap->arg, TRUE);
49034903 char_u *lambda_name;
49044904 lvar_T *lvar;
49054905 ufunc_T *ufunc;
49064906 int r;
49074907
4908+ // Only g:Func() can use a namespace.
4909+ if (name_start[1] == ':' && !is_global)
4910+ {
4911+ semsg(_(e_namespace), name_start);
4912+ return NULL;
4913+ }
49084914 if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
49094915 return NULL;
49104916
旧リポジトリブラウザで表示