0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 9.0.1296: calling an object method with arguments does not work

Problem:    Calling an object method with arguments does not work. (Ernie
            Rael)
Solution:   Take the argument count into account when looking up the object.
            (closes #11911)
This commit is contained in:
Bram Moolenaar
2023-02-10 15:52:25 +00:00
parent 6c41bedeed
commit 094cf9f4d5
3 changed files with 46 additions and 2 deletions

View File

@@ -1373,6 +1373,47 @@ def Test_class_extends()
v9.CheckScriptSuccess(lines)
enddef
def Test_using_base_class()
var lines =<< trim END
vim9script
class BaseEE
def Enter(): any
return null
enddef
def Exit(resource: any): void
enddef
endclass
class ChildEE extends BaseEE
def Enter(): any
return 42
enddef
def Exit(resource: number): void
g:result ..= '/exit'
enddef
endclass
def With(ee: BaseEE)
var r = ee.Enter()
try
g:result ..= r
finally
g:result ..= '/finally'
ee.Exit(r)
endtry
enddef
g:result = ''
With(ChildEE.new())
assert_equal('42/finally/exit', g:result)
END
v9.CheckScriptSuccess(lines)
unlet g:result
enddef
def Test_class_import()
var lines =<< trim END
vim9script