To: vim_dev@googlegroups.com Subject: Patch 9.0.1239 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1239 Problem: Cannot have a line break before an object member access. Solution: Check for "." in next line. (closes #11864) Files: src/eval.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1238/src/eval.c 2023-01-11 19:11:09.468757611 +0000 --- src/eval.c 2023-01-24 12:59:22.531029261 +0000 *************** *** 6747,6753 **** // the next line then consume the line break. p = eval_next_non_blank(*arg, evalarg, &getnext); if (getnext ! && ((rettv->v_type == VAR_DICT && *p == '.' && eval_isdictc(p[1])) || (p[0] == '-' && p[1] == '>' && (p[2] == '{' || ASCII_ISALPHA(in_vim9script() ? *skipwhite(p + 2) : p[2]))))) --- 6747,6756 ---- // the next line then consume the line break. p = eval_next_non_blank(*arg, evalarg, &getnext); if (getnext ! && ((*p == '.' ! && ((rettv->v_type == VAR_DICT && eval_isdictc(p[1])) ! || rettv->v_type == VAR_CLASS ! || rettv->v_type == VAR_OBJECT)) || (p[0] == '-' && p[1] == '>' && (p[2] == '{' || ASCII_ISALPHA(in_vim9script() ? *skipwhite(p + 2) : p[2]))))) *** ../vim-9.0.1238/src/testdir/test_vim9_class.vim 2023-01-18 14:51:03.771305354 +0000 --- src/testdir/test_vim9_class.vim 2023-01-24 13:02:50.767105858 +0000 *************** *** 439,444 **** --- 439,470 ---- var c = MyCar.new("def") END v9.CheckScriptFailure(lines, 'E1041:') + + lines =<< trim END + vim9script + + class Foo + this.x: list = [] + + def Add(n: number): any + this.x->add(n) + return this + enddef + endclass + + echo Foo.new().Add(1).Add(2).x + echo Foo.new().Add(1).Add(2) + .x + echo Foo.new().Add(1) + .Add(2).x + echo Foo.new() + .Add(1).Add(2).x + echo Foo.new() + .Add(1) + .Add(2) + .x + END + v9.CheckScriptSuccess(lines) enddef def Test_class_object_compare() *** ../vim-9.0.1238/src/version.c 2023-01-24 12:33:58.950777425 +0000 --- src/version.c 2023-01-24 13:03:09.147109936 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1239, /**/ -- I started out with nothing, and I still have most of it. -- Michael Davis -- "Tonight Show" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///