v9.CheckScriptSuccess(lines)
enddef
+def Test_script_local_other_script()
+ var lines =<< trim END
+ function LegacyJob()
+ let FuncRef = function('s:close_cb')
+ endfunction
+ function s:close_cb(...)
+ endfunction
+ END
+ lines->writefile('Xlegacy.vim')
+ source Xlegacy.vim
+ g:LegacyJob()
+ g:LegacyJob()
+ g:LegacyJob()
+
+ delfunc g:LegacyJob
+ delete('Xlegacy.vim')
+enddef
+
def Test_check_func_arg_types()
var lines =<< trim END
vim9script
/*
* There are two kinds of function names:
- * 1. ordinary names, function defined with :function or :def
- * 2. numbered functions and lambdas
+ * 1. ordinary names, function defined with :function or :def;
+ * can start with "<SNR>123_" literally or with K_SPECIAL.
+ * 2. Numbered functions and lambdas: "<lambda>123"
* For the first we only count the name stored in func_hashtab as a reference,
* using function() does not count as a reference, because the function is
* looked up by name.
int
func_name_refcount(char_u *name)
{
- return numbered_function(name) || *name == '<';
+ return numbered_function(name) || (name[0] == '<' && name[1] == 'l');
}
/*