fix(eval): v:lua support for - in module names

This commit is contained in:
bb010g 2022-01-26 20:35:12 -08:00 committed by Björn Linse
parent 6cb670cb2c
commit fb8cd340dc
3 changed files with 3 additions and 1 deletions

View File

@ -8956,7 +8956,7 @@ static bool tv_is_luafunc(typval_T *tv)
const char *skip_luafunc_name(const char *p) const char *skip_luafunc_name(const char *p)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{ {
while (ASCII_ISALNUM(*p) || *p == '_' || *p == '.' || *p == '\'') { while (ASCII_ISALNUM(*p) || *p == '_' || *p == '-' || *p == '.' || *p == '\'') {
p++; p++;
} }
return p; return p;

View File

@ -0,0 +1 @@
return {doit=function() return 9004 end}

View File

@ -532,6 +532,7 @@ describe('v:lua', function()
command('set pp+=test/functional/fixtures') command('set pp+=test/functional/fixtures')
eq('\tbadval', eval("v:lua.require'leftpad'('badval')")) eq('\tbadval', eval("v:lua.require'leftpad'('badval')"))
eq(9003, eval("v:lua.require'bar'.doit()")) eq(9003, eval("v:lua.require'bar'.doit()"))
eq(9004, eval("v:lua.require'baz-quux'.doit()"))
end) end)
it('throw errors for invalid use', function() it('throw errors for invalid use', function()