To: vim_dev@googlegroups.com Subject: Patch 8.2.1683 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1683 Problem: Vim9: assignment test fails. Solution: Include changes to find Ex command. Files: src/ex_docmd.c *** ../vim-8.2.1682/src/ex_docmd.c 2020-09-14 16:37:30.906845912 +0200 --- src/ex_docmd.c 2020-09-14 18:09:11.086579727 +0200 *************** *** 3224,3242 **** // "g:varname" is an expression. || eap->cmd[1] == ':' ) - : ( - // "varname[]" is an expression. - *p == '[' // "varname->func()" is an expression. ! || (*p == '-' && p[1] == '>') ! // "varname.expr" is an expression. ! || (*p == '.' && ASCII_ISALPHA(p[1])) ! ))) { eap->cmdidx = CMD_eval; return eap->cmd; } // "[...]->Method()" is a list expression, but "[a, b] = Func()" is // an assignment. // If there is no line break inside the "[...]" then "p" is --- 3224,3256 ---- // "g:varname" is an expression. || eap->cmd[1] == ':' ) // "varname->func()" is an expression. ! : (*p == '-' && p[1] == '>'))) { eap->cmdidx = CMD_eval; return eap->cmd; } + if (p != eap->cmd && ( + // "varname[]" is an expression. + *p == '[' + // "varname.key" is an expression. + || (*p == '.' && ASCII_ISALPHA(p[1])))) + { + char_u *after = p; + + // When followed by "=" or "+=" then it is an assignment. + ++emsg_silent; + if (skip_expr(&after) == OK + && (*after == '=' + || (*after != NUL && after[1] == '='))) + eap->cmdidx = CMD_let; + else + eap->cmdidx = CMD_eval; + --emsg_silent; + return eap->cmd; + } + // "[...]->Method()" is a list expression, but "[a, b] = Func()" is // an assignment. // If there is no line break inside the "[...]" then "p" is *** ../vim-8.2.1682/src/version.c 2020-09-14 18:15:05.513520702 +0200 --- src/version.c 2020-09-14 18:35:01.884916541 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1683, /**/ -- If you only have a hammer, you tend to see every problem as a nail. If you only have MS-Windows, you tend to solve every problem by rebooting. /// 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 ///