A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/77eb6f9dc75ebe00aa835441ad623ba46d7108bb below:

return NIL on failure to find converted function (#17779) · neovim/neovim@77eb6f9 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+47

-4

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+47

-4

lines changed Original file line number Diff line number Diff line change

@@ -65,8 +65,7 @@ typedef struct {

65 65

#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \

66 66

do { \

67 67

ufunc_T *fp = find_func(fun); \

68 -

assert(fp != NULL); \

69 -

if (fp->uf_cb == nlua_CFunction_func_call) { \

68 +

if (fp != NULL && fp->uf_cb == nlua_CFunction_func_call) { \

70 69

LuaRef ref = api_new_luaref(((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref); \

71 70

kvi_push(edata->stack, LUAREF_OBJ(ref)); \

72 71

} else { \

Original file line number Diff line number Diff line change

@@ -477,8 +477,7 @@ static bool typval_conv_special = false;

477 477

#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \

478 478

do { \

479 479

ufunc_T *fp = find_func(fun); \

480 -

assert(fp != NULL); \

481 -

if (fp->uf_cb == nlua_CFunction_func_call) { \

480 +

if (fp != NULL && fp->uf_cb == nlua_CFunction_func_call) { \

482 481

nlua_pushref(lstate, ((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref); \

483 482

} else { \

484 483

TYPVAL_ENCODE_CONV_NIL(tv); \

Original file line number Diff line number Diff line change

@@ -6,6 +6,7 @@ local assert_alive = helpers.assert_alive

6 6

local NIL = helpers.NIL

7 7

local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq

8 8

local command = helpers.command

9 +

local exec = helpers.exec

9 10

local eval = helpers.eval

10 11

local expect = helpers.expect

11 12

local funcs = helpers.funcs

@@ -1271,6 +1272,17 @@ describe('API', function()

1271 1272

eq('Key is locked: lua', pcall_err(meths.del_var, 'lua'))

1272 1273

eq('Key is locked: lua', pcall_err(meths.set_var, 'lua', 1))

1273 1274 1275 +

exec([[

1276 +

function Test()

1277 +

endfunction

1278 +

function s:Test()

1279 +

endfunction

1280 +

let g:Unknown_func = function('Test')

1281 +

let g:Unknown_script_func = function('s:Test')

1282 +

]])

1283 +

eq(NIL, meths.get_var('Unknown_func'))

1284 +

eq(NIL, meths.get_var('Unknown_script_func'))

1285 + 1274 1286

-- Check if autoload works properly

1275 1287

local pathsep = helpers.get_pathsep()

1276 1288

local xconfig = 'Xhome' .. pathsep .. 'Xconfig'

Original file line number Diff line number Diff line change

@@ -1043,6 +1043,17 @@ describe('lua stdlib', function()

1043 1043

exec_lua([[vim.api.nvim_get_var('funcs').add()]])

1044 1044

eq(6, exec_lua([[return vim.api.nvim_get_var('funcs').get()]]))

1045 1045 1046 +

exec([[

1047 +

function Test()

1048 +

endfunction

1049 +

function s:Test()

1050 +

endfunction

1051 +

let g:Unknown_func = function('Test')

1052 +

let g:Unknown_script_func = function('s:Test')

1053 +

]])

1054 +

eq(NIL, exec_lua([[return vim.g.Unknown_func]]))

1055 +

eq(NIL, exec_lua([[return vim.g.Unknown_script_func]]))

1056 + 1046 1057

-- Check if autoload works properly

1047 1058

local pathsep = helpers.get_pathsep()

1048 1059

local xconfig = 'Xhome' .. pathsep .. 'Xconfig'

@@ -1136,6 +1147,17 @@ describe('lua stdlib', function()

1136 1147

exec_lua([[vim.api.nvim_buf_get_var(0, 'funcs').add()]])

1137 1148

eq(6, exec_lua([[return vim.api.nvim_buf_get_var(0, 'funcs').get()]]))

1138 1149 1150 +

exec([[

1151 +

function Test()

1152 +

endfunction

1153 +

function s:Test()

1154 +

endfunction

1155 +

let b:Unknown_func = function('Test')

1156 +

let b:Unknown_script_func = function('s:Test')

1157 +

]])

1158 +

eq(NIL, exec_lua([[return vim.b.Unknown_func]]))

1159 +

eq(NIL, exec_lua([[return vim.b.Unknown_script_func]]))

1160 + 1139 1161

exec_lua [[

1140 1162

vim.cmd "vnew"

1141 1163

]]

@@ -1219,6 +1241,17 @@ describe('lua stdlib', function()

1219 1241

exec_lua([[vim.api.nvim_win_get_var(0, 'funcs').add()]])

1220 1242

eq(6, exec_lua([[return vim.api.nvim_win_get_var(0, 'funcs').get()]]))

1221 1243 1244 +

exec([[

1245 +

function Test()

1246 +

endfunction

1247 +

function s:Test()

1248 +

endfunction

1249 +

let w:Unknown_func = function('Test')

1250 +

let w:Unknown_script_func = function('s:Test')

1251 +

]])

1252 +

eq(NIL, exec_lua([[return vim.w.Unknown_func]]))

1253 +

eq(NIL, exec_lua([[return vim.w.Unknown_script_func]]))

1254 + 1222 1255

exec_lua [[

1223 1256

vim.cmd "vnew"

1224 1257

]]

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4