Mercurial > vim
comparison src/testdir/test_vim9_import.vim @ 27146:648a5f658990 v8.2.4102
patch 8.2.4102: Vim9: import cannot be used after method
Commit: https://github.com/vim/vim/commit/857c8bb1bbe754cf2c5b709703d2eb848c800285
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 15 21:08:19 2022 +0000
patch 8.2.4102: Vim9: import cannot be used after method
Problem: Vim9: import cannot be used after method.
Solution: Recognize an imported function name. (closes https://github.com/vim/vim/issues/9496)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Jan 2022 22:15:03 +0100 |
parents | a9eeb18e749c |
children | 2d0ea3f9ffe1 |
comparison
equal
deleted
inserted
replaced
27145:77a4efb391c0 | 27146:648a5f658990 |
---|---|
25 enddef | 25 enddef |
26 export def ExportedInc() | 26 export def ExportedInc() |
27 exported += 5 | 27 exported += 5 |
28 enddef | 28 enddef |
29 export final theList = [1] | 29 export final theList = [1] |
30 export def AddSome(s: string): string | |
31 return s .. 'some' | |
32 enddef | |
33 export var AddRef = AddSome | |
30 END | 34 END |
31 | 35 |
32 def Undo_export_script_lines() | 36 def Undo_export_script_lines() |
33 unlet g:result | 37 unlet g:result |
34 unlet g:localname | 38 unlet g:localname |
68 g:imported_name_appended = expo.exp_name | 72 g:imported_name_appended = expo.exp_name |
69 g:exported_later = expo.exported | 73 g:exported_later = expo.exported |
70 | 74 |
71 expo.theList->add(2) | 75 expo.theList->add(2) |
72 assert_equal([1, 2], expo.theList) | 76 assert_equal([1, 2], expo.theList) |
77 | |
78 assert_equal('andthensome', 'andthen'->expo.AddSome()) | |
79 assert_equal('awesome', 'awe'->expo.AddRef()) | |
73 END | 80 END |
74 writefile(import_script_lines, 'Ximport.vim') | 81 writefile(import_script_lines, 'Ximport.vim') |
75 source Ximport.vim | 82 source Ximport.vim |
76 | 83 |
77 assert_equal('bobbie', g:result) | 84 assert_equal('bobbie', g:result) |