To: vim_dev@googlegroups.com Subject: Patch 8.2.1467 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1467 Problem: Vim9: :echomsg doesn't like a dict argument. Solution: Convert arguments like in legacy script. (closes #6717) Files: src/vim9compile.c, src/vim9execute.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.1466/src/vim9compile.c 2020-08-16 17:33:29.513887840 +0200 --- src/vim9compile.c 2020-08-16 18:28:54.148911030 +0200 *************** *** 2422,2430 **** if (*p == ']') { ++p; - // Allow for following comment, after at least one space. - if (VIM_ISWHITE(*p) && *skipwhite(p) == '#') - p += STRLEN(p); break; } if (compile_expr0(&p, cctx) == FAIL) --- 2422,2427 ---- *************** *** 6206,6211 **** --- 6203,6209 ---- compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx) { char_u *p = arg; + char_u *prev; int count = 0; for (;;) *************** *** 6213,6220 **** if (compile_expr0(&p, cctx) == FAIL) return NULL; ++count; p = skipwhite(p); ! if (ends_excmd(*p)) break; } --- 6211,6219 ---- if (compile_expr0(&p, cctx) == FAIL) return NULL; ++count; + prev = p; p = skipwhite(p); ! if (ends_excmd2(prev, p)) break; } *** ../vim-8.2.1466/src/vim9execute.c 2020-08-16 17:33:29.517887810 +0200 --- src/vim9execute.c 2020-08-16 18:06:06.182243930 +0200 *************** *** 1028,1041 **** for (idx = 0; idx < count; ++idx) { tv = STACK_TV_BOT(idx - count); ! if (tv->v_type == VAR_CHANNEL || tv->v_type == VAR_JOB) { ! SOURCING_LNUM = iptr->isn_lnum; ! emsg(_(e_inval_string)); ! break; } else ! p = tv_get_string_buf(tv, buf); len = (int)STRLEN(p); if (ga_grow(&ga, len + 2) == FAIL) --- 1028,1047 ---- for (idx = 0; idx < count; ++idx) { tv = STACK_TV_BOT(idx - count); ! if (iptr->isn_type == ISN_EXECUTE) { ! if (tv->v_type == VAR_CHANNEL ! || tv->v_type == VAR_JOB) ! { ! SOURCING_LNUM = iptr->isn_lnum; ! emsg(_(e_inval_string)); ! break; ! } ! else ! p = tv_get_string_buf(tv, buf); } else ! p = tv_stringify(tv, buf); len = (int)STRLEN(p); if (ga_grow(&ga, len + 2) == FAIL) *************** *** 1050,1057 **** clear_tv(tv); } ectx.ec_stack.ga_len -= count; ! if (!failed && ga.ga_data != NULL) { if (iptr->isn_type == ISN_EXECUTE) do_cmdline_cmd((char_u *)ga.ga_data); --- 1056,1065 ---- clear_tv(tv); } ectx.ec_stack.ga_len -= count; + if (failed) + goto on_error; ! if (ga.ga_data != NULL) { if (iptr->isn_type == ISN_EXECUTE) do_cmdline_cmd((char_u *)ga.ga_data); *** ../vim-8.2.1466/src/testdir/test_vim9_script.vim 2020-08-16 17:33:29.517887810 +0200 --- src/testdir/test_vim9_script.vim 2020-08-16 18:24:47.378668779 +0200 *************** *** 2102,2107 **** --- 2102,2110 ---- execute 'echomsg' (n ? '"true"' : '"no"') assert_match('^true$', Screenline(&lines)) + echomsg [1, 2, 3] #{a: 1, b: 2} + assert_match('^\[1, 2, 3\] {''a'': 1, ''b'': 2}$', Screenline(&lines)) + call CheckDefFailure(['execute xxx'], 'E1001:') call CheckDefFailure(['execute "cmd"# comment'], 'E488:') enddef *** ../vim-8.2.1466/src/version.c 2020-08-16 17:33:29.517887810 +0200 --- src/version.c 2020-08-16 18:26:42.953849559 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1467, /**/ -- From the classified section of a city newspaper: Dog for sale: eats anything and is fond of children. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///