To: vim_dev@googlegroups.com Subject: Patch 8.2.1322 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1322 Problem: Vim9: method on double quoted string doesn't work. Solution: Recognize double quoted string. (closes #6562) Files: src/ex_docmd.c, src/testdir/test_vim9_func.vim, src/testdir/test_vim9_expr.vim *** ../vim-8.2.1321/src/ex_docmd.c 2020-07-28 22:38:34.244502300 +0200 --- src/ex_docmd.c 2020-07-29 19:46:52.683565692 +0200 *************** *** 3277,3283 **** char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$' || *eap->cmd == '@') ? eap->cmd + 1 : eap->cmd; ! if (vim_strchr((char_u *)"{('[", *p) != NULL || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) { int oplen; --- 3277,3283 ---- char_u *pskip = (*eap->cmd == '&' || *eap->cmd == '$' || *eap->cmd == '@') ? eap->cmd + 1 : eap->cmd; ! if (vim_strchr((char_u *)"{('[\"", *p) != NULL || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL)) { int oplen; *************** *** 3293,3298 **** --- 3293,3300 ---- *eap->cmd == '{' // "'string'->func()" is an expression. || *eap->cmd == '\'' + // '"string"->func()' is an expression. + || *eap->cmd == '"' // "g:varname" is an expression. || eap->cmd[1] == ':' ) *** ../vim-8.2.1321/src/testdir/test_vim9_func.vim 2020-07-26 18:33:05.869028796 +0200 --- src/testdir/test_vim9_func.vim 2020-07-29 19:55:29.208956620 +0200 *************** *** 502,509 **** --- 502,512 ---- assert_equal('some', var) # line starting with single quote is not a mark + # line starting with double quote can be a method call 'asdfasdf'->MyFunc() assert_equal('asdfasdf', var) + "xyz"->MyFunc() + assert_equal('xyz', var) def UseString() 'xyork'->MyFunc() *************** *** 511,516 **** --- 514,525 ---- UseString() assert_equal('xyork', var) + def UseString2() + "knife"->MyFunc() + enddef + UseString2() + assert_equal('knife', var) + # prepending a colon makes it a mark new setline(1, ['aaa', 'bbb', 'ccc']) *** ../vim-8.2.1321/src/testdir/test_vim9_expr.vim 2020-07-27 21:43:24.137946109 +0200 --- src/testdir/test_vim9_expr.vim 2020-07-29 19:59:49.183574428 +0200 *************** *** 1638,1645 **** def Test_expr7_method_call() new setline(1, ['first', 'last']) ! eval 'second'->append(1) ! assert_equal(['first', 'second', 'last'], getline(1, '$')) bwipe! let bufnr = bufnr() --- 1638,1646 ---- def Test_expr7_method_call() new setline(1, ['first', 'last']) ! 'second'->append(1) ! "third"->append(2) ! assert_equal(['first', 'second', 'third', 'last'], getline(1, '$')) bwipe! let bufnr = bufnr() *** ../vim-8.2.1321/src/version.c 2020-07-29 19:29:20.368813411 +0200 --- src/version.c 2020-07-29 19:49:03.890920073 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1322, /**/ -- There's no place like $(HOME)! /// 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 ///