Patch 9.0.1175
Patch 9.0.1175 Problem:The set_ref_in_item() function is too long. Solution: Use a separate function for more complicated types. (Yegappan Lakshmanan, closes #11802) Files: src/eval.c *** ../vim-9.0.1174/src/eval.c 2023-01-06 18:42:16.434674109 + --- src/eval.c 2023-01-11 11:44:37.922251835 + *** *** 5484,5489 --- 5484,5738 } /* + * Mark the dict "dd" with "copyID". + * Also see set_ref_in_item(). + */ + static int + set_ref_in_item_dict( + dict_T*dd, + int copyID, + ht_stack_T**ht_stack, + list_stack_T **list_stack) + { + if (dd == NULL || dd->dv_copyID == copyID) + return FALSE; + + // Didn't see this dict yet. + dd->dv_copyID = copyID; + if (ht_stack == NULL) + return set_ref_in_ht(&dd->dv_hashtab, copyID, list_stack); + + ht_stack_T *newitem = ALLOC_ONE(ht_stack_T); + if (newitem == NULL) + return TRUE; + + newitem->ht = &dd->dv_hashtab; + newitem->prev = *ht_stack; + *ht_stack = newitem; + + return FALSE; + } + + /* + * Mark the list "ll" with "copyID". + * Also see set_ref_in_item(). + */ + static int + set_ref_in_item_list( + list_T*ll, + int copyID, + ht_stack_T**ht_stack, + list_stack_T **list_stack) + { + if (ll == NULL || ll->lv_copyID == copyID) + return FALSE; + + // Didn't see this list yet. + ll->lv_copyID = copyID; + if (list_stack == NULL) + return set_ref_in_list_items(ll, copyID, ht_stack); + + list_stack_T *newitem = ALLOC_ONE(list_stack_T); + if (newitem == NULL) + return TRUE; + + newitem->list = ll; + newitem->prev = *list_stack; + *list_stack = newitem; + + return FALSE; + } + + /* + * Mark the partial "pt" with "copyID". + * Also see set_ref_in_item(). + */ + static int + set_ref_in_item_partial( + partial_T *pt, + int copyID, + ht_stack_T**ht_stack, + list_stack_T **list_stack) + { + if (pt == NULL || pt->pt_copyID == copyID) + return FALSE; + + // Didn't see this partial yet. + pt->pt_copyID = copyID; + + int abort = set_ref_in_func(pt->pt_name, pt->pt_func, copyID); + + if (pt->pt_dict != NULL) + { + typval_T dtv; + + dtv.v_type = VAR_DICT; + dtv.vval.v_dict = pt->pt_dict; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + + for (int i = 0; i < pt->pt_argc; ++i) + abort = abort || set_ref_in_item(&pt->pt_argv[i], copyID, + ht_stack, list_stack); + // pt_funcstack is handled in set_ref_in_funcstacks() + // pt_loopvars is handled in set_ref_in_loopvars() + + return abort; + } + + /* + * Mark the job "pt" with "copyID". + * Also see set_ref_in_item(). + */ + static int + set_ref_in_item_job( + job_T *job, + int copyID, + ht_stack_T**ht_stack, + list_stack_T **list_stack) + { + #ifdef FEAT_JOB_CHANNEL + typval_Tdtv; + + if (job == NULL || job->jv_copyID == copyID) + return FALSE; + + job->jv_copyID = copyID; + if (job->jv_channel != NULL) + { + dtv.v_type = VAR_CHANNEL; + dtv.vval.v_channel = job->jv_channel; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + if (job->jv_exit_cb.cb_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = job->jv_exit_cb.cb_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + #endif + + return FALSE; + } + + /* + * Mark the channel "ch" with "copyID". + * Also see set_ref_in_item(). + */ + static int + set_ref_in_item_channel( + channel_T *ch, + int copyID, + ht_stack_T**ht_stack, + list_stack_T **list_stack) + { + #ifdef FEAT_JOB_CHANNEL + typval_Tdtv; + + if (ch == NULL || ch->ch_copyID == copyID) + return FALSE; + + ch->ch_copyID = copyID; + for (ch_part_T part = PART_SOCK; part < PART_COUNT; ++part) + { + for (jsonq_T *jq = ch->ch_part[part].ch_json_head.jq_next; + jq != NULL; jq = jq->jq_next) + set_ref_in_item(jq->jq_value, copyID, ht_stack, list_stack); + for (cbq_T *cq = ch->ch_part[part].ch_cb_head.cq_next; cq != NULL; + cq = cq->cq_next) + if (cq->cq_callback.cb_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = cq->cq_callback.cb_partial; + set_ref_in_item(&dtv, copyID, ht_stack, list_stack); + } + if (ch->ch_part[part].ch_callback.cb_partial != NULL) + { + dtv.v_type = VAR_PARTIAL; + dtv.vval.v_partial = ch->ch_part[part].ch_callback.
Patch 9.0.1176
Patch 9.0.1176 Problem:smithy files are not recognized. Solution: Add a pattern for Smithy files. (Chris Kipp, closes #11804) Files: runtime/filetype.vim, src/testdir/test_filetype.vim *** ../vim-9.0.1175/runtime/filetype.vim2023-01-10 19:58:31.030209252 + --- runtime/filetype.vim2023-01-11 12:17:42.557960886 + *** *** 110,118 " Applescript au BufNewFile,BufRead *.scpt setf applescript " Applix ELF ! au BufNewFile,BufRead *.am ! \ if expand("") !~? 'Makefile.am\>' | setf elf | endif " ALSA configuration au BufNewFile,BufRead .asoundrc,*/usr/share/alsa/alsa.conf,*/etc/asound.conf setf alsaconf --- 110,120 " Applescript au BufNewFile,BufRead *.scpt setf applescript + " Automake (must be before the *.am pattern) + au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake + " Applix ELF ! au BufNewFile,BufRead *.amsetf elf " ALSA configuration au BufNewFile,BufRead .asoundrc,*/usr/share/alsa/alsa.conf,*/etc/asound.conf setf alsaconf *** *** 187,195 " Autohotkey au BufNewFile,BufRead *.ahk setf autohotkey - " Automake - au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake - " Autotest .at files are actually m4 au BufNewFile,BufRead *.atsetf m4 --- 189,194 *** *** 1928,1933 --- 1927,1935 " SMITH au BufNewFile,BufRead *.smt,*.smith setf smith + " Smithy + au BufNewFile,BufRead *.smithysetf smithy + " Snobol4 and spitbol au BufNewFile,BufRead *.sno,*.spt setf snobol4 *** ../vim-9.0.1175/src/testdir/test_filetype.vim 2023-01-10 19:58:31.030209252 + --- src/testdir/test_filetype.vim 2023-01-11 12:16:59.633842016 + *** *** 528,533 --- 528,534 \ 'smarty': ['file.tpl'], \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'], \ 'smith': ['file.smt', 'file.smith'], + \ 'smithy': ['file.smithy'], \ 'sml': ['file.sml'], \ 'snobol4': ['file.sno', 'file.spt'], \ 'solidity': ['file.sol'], *** ../vim-9.0.1175/src/version.c 2023-01-11 11:46:15.065636518 + --- src/version.c 2023-01-11 12:18:59.530427692 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1176, /**/ -- Article in the first Free Software Magazine: "Bram Moolenaar studied electrical engineering at the Technical University of Delft and graduated in 1985 on a multi-processor Unix architecture." Response by "dimator": Could the school not afford a proper stage for the ceremony? /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/2023022054.EE3221C0857%40moolenaar.net.
Patch 9.0.1177
Patch 9.0.1177 Problem:AppVeyor uses some older tools. Solution: Switch to Visual Studio 2022 and Python 3.11. (Christopher Plewright, closes #11793) Files: .appveyor.yml, ci/appveyor.bat *** ../vim-9.0.1176/.appveyor.yml 2023-01-04 18:05:55.408803650 + --- .appveyor.yml 2023-01-11 12:48:43.621422888 + *** *** 1,6 version: "{build}" ! image: Visual Studio 2015 skip_tags: true --- 1,6 version: "{build}" ! image: Visual Studio 2022 skip_tags: true *** *** 16,23 fast_finish: true before_build: ! # Use Visual Studio 2015 compiler tools (default is 2012) ! - '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64' build_script: - ci/appveyor.bat --- 16,36 fast_finish: true before_build: ! # Use latest compiler tools (Visual Studio 2022) ! - setlocal ENABLEDELAYEDEXPANSION ! - call ver ! - set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ! - > ! if exist "%VSWHERE%" ( ! for /f "usebackq delims=" %%i ! in (`"%VSWHERE%" -products * -latest -property installationPath`) ! do (set "VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat") ! ) ! - > ! if not exist "%VCVARSALL%" ( ! set "VCVARSALL=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ! ) ! - call "%VCVARSALL%" x64 build_script: - ci/appveyor.bat *** *** 25,31 test_script: - cd src/testdir # Testing with MSVC gvim ! - path C:\Python35-x64;%PATH% - nmake -f Make_mvc.mak VIMPROG=..\gvim - nmake -f Make_mvc.mak clean # Testing with MSVC console version --- 38,44 test_script: - cd src/testdir # Testing with MSVC gvim ! - path C:\Python311-x64;%PATH% - nmake -f Make_mvc.mak VIMPROG=..\gvim - nmake -f Make_mvc.mak clean # Testing with MSVC console version *** ../vim-9.0.1176/ci/appveyor.bat 2022-01-26 16:16:49.0 + --- ci/appveyor.bat 2023-01-11 12:48:43.621422888 + *** *** 22,28 nmake -f Make_mvc.mak CPU=AMD64 ^ OLE=no GUI=yes IME=yes ICONV=yes DEBUG=no POSTSCRIPT=yes ^ PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27-x64 ^ ! PYTHON3_VER=35 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python35-x64 ^ FEATURES=%FEATURE% ) ELSE ( nmake -f Make_mvc.mak CPU=AMD64 ^ --- 22,28 nmake -f Make_mvc.mak CPU=AMD64 ^ OLE=no GUI=yes IME=yes ICONV=yes DEBUG=no POSTSCRIPT=yes ^ PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27-x64 ^ ! PYTHON3_VER=311 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python311-x64 ^ FEATURES=%FEATURE% ) ELSE ( nmake -f Make_mvc.mak CPU=AMD64 ^ *** ../vim-9.0.1176/src/version.c 2023-01-11 12:20:01.782758340 + --- src/version.c 2023-01-11 12:49:01.025428473 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1177, /**/ -- The fastest way to get an engineer to solve a problem is to declare that the problem is unsolvable. No engineer can walk away from an unsolvable problem until it's solved. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/2023025000.773E11C07A0%40moolenaar.net.
Patch 9.0.1178
Patch 9.0.1178 Problem:A child class cannot override functions from a base class. Solution: Allow overriding and implement "super". Files: src/vim9class.c, src/structs.h, src/errors.h, src/vim9expr.c, src/globals.h, src/vim9compile.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1177/src/vim9class.c 2023-01-08 19:54:06.948281440 + --- src/vim9class.c 2023-01-11 15:47:43.097274255 + *** *** 487,495 if (uf != NULL) { ! int is_new = STRNCMP(uf->uf_name, "new", 3) == 0; garray_T *fgap = has_static || is_new ? &classfunctions : &objmethods; if (ga_grow(fgap, 1) == OK) { if (is_new) --- 487,507 if (uf != NULL) { ! char_u *name = uf->uf_name; ! int is_new = STRNCMP(name, "new", 3) == 0; garray_T *fgap = has_static || is_new ? &classfunctions : &objmethods; + // Check the name isn't used already. + for (int i = 0; i < fgap->ga_len; ++i) + { + char_u *n = ((ufunc_T **)fgap->ga_data)[i]->uf_name; + if (STRCMP(name, n) == 0) + { + semsg(_(e_duplicate_function_str), name); + break; + } + } + if (ga_grow(fgap, 1) == OK) { if (is_new) *** *** 793,799 if (nf != NULL && ga_grow(&classfunctions, 1) == OK) { ! ((ufunc_T **)classfunctions.ga_data)[classfunctions.ga_len] = nf; ++classfunctions.ga_len; nf->uf_flags |= FC_NEW; --- 805,812 if (nf != NULL && ga_grow(&classfunctions, 1) == OK) { ! ((ufunc_T **)classfunctions.ga_data)[classfunctions.ga_len] ! = nf; ++classfunctions.ga_len; nf->uf_flags |= FC_NEW; *** *** 808,813 --- 821,827 } } + // Move all the functions into the created class. // loop 1: class functions, loop 2: object methods for (int loop = 1; loop <= 2; ++loop) { *** *** 834,859 if (*fup == NULL) goto cleanup; int skipped = 0; for (int i = 0; i < parent_count; ++i) { // Copy functions from the parent. Can't use the same // function, because "uf_class" is different and compilation // will have a different result. // Skip "new" functions. TODO: not all of them. if (loop == 1 && STRNCMP( extends_cl->class_class_functions[i]->uf_name, "new", 3) == 0) ++skipped; else ! *fup[i - skipped] = copy_function((loop == 1 ? extends_cl->class_class_functions ! : extends_cl->class_obj_methods)[i]); } - mch_memmove(*fup + parent_count - skipped, gap->ga_data, - sizeof(ufunc_T *) * gap->ga_len); - vim_free(gap->ga_data); *fcount -= skipped; // Set the class pointer on all the functions and object methods. --- 848,899 if (*fup == NULL) goto cleanup; + mch_memmove(*fup, gap->ga_data, sizeof(ufunc_T *) * gap->ga_len); + vim_free(gap->ga_data); + if (loop == 1) + cl->class_class_function_count_child = gap->ga_len; + else + cl->class_obj_method_count_child = gap->ga_len; + int skipped = 0; for (int i = 0; i < parent_count; ++i) { // Copy functions from the parent. Can't use the same // function, because "uf_class" is different and compilation // will have a different result. + // Put them after the functions in the current class, object + // methods may be overruled, then "super.Method()" is used to + // find a method from the parent. // Skip "new" functions. TODO: not all of them. if (loop == 1 && STRNCMP( extends_cl->class_class_functions[i]->uf_name, "new", 3) == 0) ++skipped; else ! { ! ufunc_T *pf = (loop == 1 ? exte
Patch 9.0.1179
Patch 9.0.1179 Problem:Not all errors around inheritance are tested. Solution: Add more tests. Fix uncovered problems. Files: src/vim9expr.c, src/vim9compile.c, src/errors.h, src/testdir/test_vim9_class.vim *** ../vim-9.0.1178/src/vim9expr.c 2023-01-11 15:59:01.175405240 + --- src/vim9expr.c 2023-01-11 17:44:15.145607859 + *** *** 268,281 if (type == &t_super) { if (cctx->ctx_ufunc == NULL || cctx->ctx_ufunc->uf_class == NULL) - emsg(_(e_using_super_not_in_class_function)); - else { ! is_super = TRUE; ! cl = cctx->ctx_ufunc->uf_class; ! // Remove &t_super from the stack. ! --cctx->ctx_type_stack.ga_len; } } else if (type->tt_type == VAR_CLASS) { --- 268,281 if (type == &t_super) { if (cctx->ctx_ufunc == NULL || cctx->ctx_ufunc->uf_class == NULL) { ! emsg(_(e_using_super_not_in_class_function)); ! return FAIL; } + is_super = TRUE; + cl = cctx->ctx_ufunc->uf_class; + // Remove &t_super from the stack. + --cctx->ctx_type_stack.ga_len; } else if (type->tt_type == VAR_CLASS) { *** *** 2261,2266 --- 2261,2267 // class constructor: SomeClass.new() // object member: someObject.varname, this.varname // object method: someObject.SomeMethod(), this.SomeMethod() + *arg = p; if (compile_class_object_index(cctx, arg, type) == FAIL) return FAIL; } *** ../vim-9.0.1178/src/vim9compile.c 2023-01-11 15:59:01.175405240 + --- src/vim9compile.c 2023-01-11 17:47:12.981868019 + *** *** 49,54 --- 49,68 && (cctx->ctx_ufunc->uf_flags & (FC_OBJECT|FC_NEW))) { int is_super = *name == 's'; + if (is_super) + { + if (name[5] != '.') + { + emsg(_(e_super_must_be_followed_by_dot)); + return FAIL; + } + if (cctx->ctx_ufunc->uf_class != NULL + && cctx->ctx_ufunc->uf_class->class_extends == NULL) + { + emsg(_(e_using_super_not_in_child_class)); + return FAIL; + } + } if (lvar != NULL) { CLEAR_POINTER(lvar); *** ../vim-9.0.1178/src/errors.h2023-01-11 15:59:01.175405240 + --- src/errors.h2023-01-11 17:47:04.781857302 + *** *** 3438,3441 --- 3438,3443 INIT(= N_("E1356: \"super\" must be followed by a dot")); EXTERN char e_using_super_not_in_class_function[] INIT(= N_("E1357: Using \"super\" not in a class function")); + EXTERN char e_using_super_not_in_child_class[] + INIT(= N_("E1358: Using \"super\" not in a child class")); #endif *** ../vim-9.0.1178/src/testdir/test_vim9_class.vim 2023-01-11 15:59:01.175405240 + --- src/testdir/test_vim9_class.vim 2023-01-11 17:54:55.530339186 + *** *** 838,843 --- 838,900 assert_equal('John: 42', o.ToString()) END v9.CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + class Child + this.age: number + def ToString(): number + return this.age + enddef + def ToString(): string + return this.age + enddef + endclass + END + v9.CheckScriptFailure(lines, 'E1355: Duplicate function: ToString') + + lines =<< trim END + vim9script + class Child + this.age: number + def ToString(): string + return super .ToString() .. ': ' .. this.age + enddef + endclass + var o = Child.new(42) + echo o.ToString() + END + v9.CheckScriptFailure(lines, 'E1356:') + + lines =<< trim END + vim9script + class Base + this.name: string + def ToString(): string + return this.name + enddef + endclass + + var age = 42 + def ToString(): string + return super.ToString() .. ': ' .. age + enddef + echo ToString() + END + v9.CheckScriptFailure(lines, 'E1357:') + + lines =<< trim END + vim9script + class Child + this.age: number + def ToString(): string + return super.ToString() .. ': ' .. this.age + enddef + endclass + var o = Child.new(42) + echo o.ToString() + END + v9.CheckScriptFailure(lines, 'E1358:') enddef *** ../vim-9.0.1178/src/version.c 2023-01-11 15:59:01.179405247 + --- src/version.c 2023-01-11 17:19:20.187997015 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1179, /**/ -- For humans, honesty is a matter of degree. Engineers are always honest in matters of technology and human relatio
Re: Patch 9.0.1175
On 11-Jan-2023 22:46, Bram Moolenaar wrote: Patch 9.0.1175 Problem:The set_ref_in_item() function is too long. Solution: Use a separate function for more complicated types. (Yegappan Lakshmanan, closes #11802) Files: src/eval.c After this patch msys64 (clang 15.0.5) gives this error message: clang -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO -pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD eval.c -o gobjx86-64/eval.o eval.c:5773:42: error: no member named 'v_job' in 'union typval_S::(unnamed at ./structs.h:1548:5)' return set_ref_in_item_job(tv->vval.v_job, copyID, ^ eval.c:5777:46: error: no member named 'v_channel' in 'union typval_S::(unnamed at ./structs.h:1548:5)' return set_ref_in_item_channel(tv->vval.v_channel, copyID, ^ 2 errors generated. make: *** [Make_cyg_ming.mak:1206: gobjx86-64/eval.o] Error 1 The attached patch tries to fix it. Cheers John -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/029b4220-a6b3-5dcf-aa38-fec5b8709308%40internode.on.net. --- eval.c.orig 2023-01-12 05:46:53.096761500 +1100 +++ eval.c 2023-01-12 06:01:15.55792 +1100 @@ -5580,6 +5580,7 @@ return abort; } +#ifdef FEAT_JOB_CHANNEL /* * Mark the job "pt" with "copyID". * Also see set_ref_in_item(). @@ -5591,7 +5592,6 @@ ht_stack_T **ht_stack, list_stack_T **list_stack) { -#ifdef FEAT_JOB_CHANNEL typval_Tdtv; if (job == NULL || job->jv_copyID == copyID) @@ -5610,7 +5610,6 @@ dtv.vval.v_partial = job->jv_exit_cb.cb_partial; set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } -#endif return FALSE; } @@ -5626,7 +5625,6 @@ ht_stack_T **ht_stack, list_stack_T **list_stack) { -#ifdef FEAT_JOB_CHANNEL typval_Tdtv; if (ch == NULL || ch->ch_copyID == copyID) @@ -5665,10 +5663,10 @@ dtv.vval.v_partial = ch->ch_close_cb.cb_partial; set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } -#endif return FALSE; } +#endif /* * Mark the class "cl" with "copyID". @@ -5770,12 +5768,20 @@ ht_stack, list_stack); case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL return set_ref_in_item_job(tv->vval.v_job, copyID, ht_stack, list_stack); +#else + break; +#endif case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL return set_ref_in_item_channel(tv->vval.v_channel, copyID, ht_stack, list_stack); +#else + break; +#endif case VAR_CLASS: return set_ref_in_item_class(tv->vval.v_class, copyID,
Re: Patch 9.0.1175
John Marriott wrote: > On 11-Jan-2023 22:46, Bram Moolenaar wrote: > > Patch 9.0.1175 > > Problem:The set_ref_in_item() function is too long. > > Solution: Use a separate function for more complicated types. (Yegappan > > Lakshmanan, closes #11802) > > Files: src/eval.c > > > > > > > After this patch msys64 (clang 15.0.5) gives this error message: > > clang -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 > -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO > -pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE -DFEAT_GUI_MSWIN > -DFEAT_CLIPBOARD eval.c -o gobjx86-64/eval.o > eval.c:5773:42: error: no member named 'v_job' in 'union > typval_S::(unnamed at ./structs.h:1548:5)' > return set_ref_in_item_job(tv->vval.v_job, copyID, > ^ > eval.c:5777:46: error: no member named 'v_channel' in 'union > typval_S::(unnamed at ./structs.h:1548:5)' > return set_ref_in_item_channel(tv->vval.v_channel, copyID, > ^ > 2 errors generated. > make: *** [Make_cyg_ming.mak:1206: gobjx86-64/eval.o] Error 1 > > > The attached patch tries to fix it. I'll include it, thanks. -- While it's true that many normal people whould prefer not to _date_ an engineer, most normal people harbor an intense desire to _mate_ with them, thus producing engineerlike children who will have high-paying jobs long before losing their virginity. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/2023091146.6ABEA1C07A0%40moolenaar.net.
Patch 9.0.1180
Patch 9.0.1180 (after 9.0.1175) Problem:Compiler warnings without the +job feature. Solution: Adjust #ifdefs. (John Marriott) Files: src/eval.c *** ../vim-9.0.1179/src/eval.c 2023-01-11 11:46:15.065636518 + --- src/eval.c 2023-01-11 19:08:44.952812349 + *** *** 5580,5585 --- 5580,5586 return abort; } + #ifdef FEAT_JOB_CHANNEL /* * Mark the job "pt" with "copyID". * Also see set_ref_in_item(). *** *** 5591,5597 ht_stack_T**ht_stack, list_stack_T **list_stack) { - #ifdef FEAT_JOB_CHANNEL typval_Tdtv; if (job == NULL || job->jv_copyID == copyID) --- 5592,5597 *** *** 5610,5616 dtv.vval.v_partial = job->jv_exit_cb.cb_partial; set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } - #endif return FALSE; } --- 5610,5615 *** *** 5626,5632 ht_stack_T**ht_stack, list_stack_T **list_stack) { - #ifdef FEAT_JOB_CHANNEL typval_Tdtv; if (ch == NULL || ch->ch_copyID == copyID) --- 5625,5630 *** *** 5665,5674 dtv.vval.v_partial = ch->ch_close_cb.cb_partial; set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } - #endif return FALSE; } /* * Mark the class "cl" with "copyID". --- 5663,5672 dtv.vval.v_partial = ch->ch_close_cb.cb_partial; set_ref_in_item(&dtv, copyID, ht_stack, list_stack); } return FALSE; } + #endif /* * Mark the class "cl" with "copyID". *** *** 5770,5781 --- 5768,5787 ht_stack, list_stack); case VAR_JOB: + #ifdef FEAT_JOB_CHANNEL return set_ref_in_item_job(tv->vval.v_job, copyID, ht_stack, list_stack); + #else + break; + #endif case VAR_CHANNEL: + #ifdef FEAT_JOB_CHANNEL return set_ref_in_item_channel(tv->vval.v_channel, copyID, ht_stack, list_stack); + #else + break; + #endif case VAR_CLASS: return set_ref_in_item_class(tv->vval.v_class, copyID, *** ../vim-9.0.1179/src/version.c 2023-01-11 17:59:35.114319167 + --- src/version.c 2023-01-11 19:11:01.020760496 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1180, /**/ -- Female engineers become irresistible at the age of consent and remain that way until about thirty minutes after their clinical death. Longer if it's a warm day. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/2023091146.6F01F1C042F%40moolenaar.net.
Patch 9.0.1181
Patch 9.0.1181 Problem:Class inheritance and typing insufficiently tested. Solution: Add more tests. Implement missing behavior. Files: src/vim9type.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1180/src/vim9type.c 2023-01-09 14:18:09.235577964 + --- src/vim9type.c 2023-01-11 21:06:20.876226855 + *** *** 874,879 --- 874,890 // check the argument count at runtime ret = MAYBE; } + else if (expected->tt_type == VAR_OBJECT) + { + class_T *cl; + for (cl = (class_T *)actual->tt_member; cl != NULL; + cl = cl->class_extends) + if ((class_T *)expected->tt_member == cl) + break; + if (cl == NULL) + ret = FAIL; + } + if (ret == FAIL && give_msg) type_mismatch_where(expected, actual, where); } *** *** 1601,1613 if (type == NULL) return "[unknown]"; name = vartype_name(type->tt_type); if (type->tt_type == VAR_LIST || type->tt_type == VAR_DICT) { char *member_free; char *member_name = type_name(type->tt_member, &member_free); ! size_t len; ! ! len = STRLEN(name) + STRLEN(member_name) + 3; *tofree = alloc(len); if (*tofree != NULL) { --- 1612,1623 if (type == NULL) return "[unknown]"; name = vartype_name(type->tt_type); + if (type->tt_type == VAR_LIST || type->tt_type == VAR_DICT) { char *member_free; char *member_name = type_name(type->tt_member, &member_free); ! size_t len = STRLEN(name) + STRLEN(member_name) + 3; *tofree = alloc(len); if (*tofree != NULL) { *** *** 1616,1621 --- 1626,1644 return *tofree; } } + + if (type->tt_type == VAR_OBJECT || type->tt_type == VAR_CLASS) + { + char_u *class_name = ((class_T *)type->tt_member)->class_name; + size_t len = STRLEN(name) + STRLEN(class_name) + 3; + *tofree = alloc(len); + if (*tofree != NULL) + { + vim_snprintf(*tofree, len, "%s<%s>", name, class_name); + return *tofree; + } + } + if (type->tt_type == VAR_FUNC) { garray_Tga; *** ../vim-9.0.1180/src/testdir/test_vim9_class.vim 2023-01-11 17:59:35.114319167 + --- src/testdir/test_vim9_class.vim 2023-01-11 21:06:48.928219836 + *** *** 419,424 --- 419,462 endfor enddef + def Test_object_type() + var lines =<< trim END + vim9script + + class One + this.one = 1 + endclass + class Two + this.two = 2 + endclass + class TwoMore extends Two + this.more = 9 + endclass + + var o: One = One.new() + var t: Two = Two.new() + var m: TwoMore = TwoMore.new() + var tm: Two = TwoMore.new() + + t = m + END + v9.CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + + class One + this.one = 1 + endclass + class Two + this.two = 2 + endclass + + var o: One = Two.new() + END + v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object but got object') + enddef + def Test_class_member() # check access rules var lines =<< trim END *** *** 750,756 var p: Point p = 'text' END ! v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object but got string') enddef def Test_class_extends() --- 788,794 var p: Point p = 'text' END ! v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object but got string') enddef def Test_class_extends() *** *** 895,900 --- 933,959 echo o.ToString() END v9.CheckScriptFailure(lines, 'E1358:') + + lines =<< trim END + vim9script + class Base + this.name: string + static def ToString(): string + return 'Base class' + enddef + endclass + + class Child extends Base + this.age: number + def ToString(): string + return Base.ToString() .. ': ' .. this.age + enddef + endclass + + var o = Child.new('John', 42) + assert_equal('Base class: 42', o.ToString()) + END + v9.CheckScriptSuccess(lines) enddef *** ../vim-9.0.1180/src/version.c 2023-01-11 19:11:09.468757611 + --- src/version.c 2023-01-11 20:35:18.656552352 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1181, /**/ -- Every engineer dreams about saving the universe and having sex with aliens. This is much more glamorous than the real life of an engineer, which consists of hiding from the universe a
Patch 9.0.1182
Patch 9.0.1182 Problem:go checksum files are not recognized. Solution: Add the name of go checksum files. (Amaan Qureshi, closes #11803) Files: runtime/filetype.vim, src/testdir/test_filetype.vim *** ../vim-9.0.1181/runtime/filetype.vim2023-01-11 12:20:01.782758340 + --- runtime/filetype.vim2023-01-11 21:20:28.148006809 + *** *** 849,854 --- 849,857 " HCL au BufRead,BufNewFile *.hcl setf hcl + " Go checksum file (must be before *.sum Hercules) + au BufNewFile,BufRead go.sum setf gosum + " Hercules au BufNewFile,BufRead *.vc,*.ev,*.sum,*.errsumsetf hercules *** ../vim-9.0.1181/src/testdir/test_filetype.vim 2023-01-11 12:20:01.782758340 + --- src/testdir/test_filetype.vim 2023-01-11 21:21:14.171994580 + *** *** 230,235 --- 230,236 \ 'gnuplot': ['file.gpi', '.gnuplot'], \ 'go': ['file.go'], \ 'gomod': ['go.mod'], + \ 'gosum': ['go.sum'], \ 'gowork': ['go.work'], \ 'gp': ['file.gp', '.gprc'], \ 'gpg': ['/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel', 'any/.gnupg/gpg.conf', 'any/.gnupg/options', 'any/usr/any/gnupg/options.skel'], *** ../vim-9.0.1181/src/version.c 2023-01-11 21:14:11.832106048 + --- src/version.c 2023-01-11 21:23:01.043966159 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1182, /**/ -- EXPERIENCE - experience is a wonderful thing. It enables you to recognise a mistake when you make it again. /// Bram Moolenaar -- b...@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/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20230111212545.0FED41C07A0%40moolenaar.net.