forked from aniani/vim
patch 8.2.4323: Vim9: nested function name can start with "_"
Problem: Vim9: nested function name can start with "_". Solution: Use same rule for function name for nested functions. (closes #9713)
This commit is contained in:
@@ -679,6 +679,30 @@ def Test_nested_function()
|
||||
assert_equal('ok', g:result)
|
||||
unlet g:result
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
def Outer()
|
||||
def _Inner()
|
||||
echo 'bad'
|
||||
enddef
|
||||
Inner()
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E128:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
def Outer()
|
||||
def g:inner()
|
||||
echo 'bad'
|
||||
enddef
|
||||
Inner()
|
||||
enddef
|
||||
defcompile
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E128:')
|
||||
|
||||
# nested function inside conditional
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
@@ -3135,11 +3159,11 @@ func Test_partial_call_fails()
|
||||
def Iter(container: any): any
|
||||
var idx = -1
|
||||
var obj = {state: container}
|
||||
def g:__NextItem__(self: dict<any>): any
|
||||
def g:NextItem__(self: dict<any>): any
|
||||
++idx
|
||||
return self.state[idx]
|
||||
enddef
|
||||
obj.__next__ = function('g:__NextItem__', [obj])
|
||||
obj.__next__ = function('g:NextItem__', [obj])
|
||||
return obj
|
||||
enddef
|
||||
|
||||
|
Reference in New Issue
Block a user