Problem: Expanding <sfile> works differently the second time.
Solution: Keep the expanded name when redefining a function. (closes #5425)
enew! | close
endfunc
+func Test_script_expand_sfile()
+ let lines =<< trim END
+ func s:snr()
+ return expand('<sfile>')
+ endfunc
+ let g:result = s:snr()
+ END
+ call writefile(lines, 'Xexpand')
+ source Xexpand
+ call assert_match('<SNR>\d\+_snr', g:result)
+ source Xexpand
+ call assert_match('<SNR>\d\+_snr', g:result)
+
+ call delete('Xexpand')
+ unlet g:result
+endfunc
+
func Test_compound_assignment_operators()
" Test for number
let x = 1
}
else
{
- // redefine existing function
+ char_u *exp_name = fp->uf_name_exp;
+
+ // redefine existing function, keep the expanded name
VIM_CLEAR(name);
+ fp->uf_name_exp = NULL;
func_clear_items(fp);
+ fp->uf_name_exp = exp_name;
#ifdef FEAT_PROFILE
fp->uf_profiling = FALSE;
fp->uf_prof_initialized = FALSE;
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 78,
/**/
77,
/**/