[BUG] Two :execute+:try/:catch bugs

18 views
Skip to first unread message

ZyX

unread,
Sep 15, 2013, 6:43:16 AM9/15/13
to vim...@googlegroups.com
Consider the following script:

function! ERB()
execute "try"
\."\n echo tr()"
\."\n catch"
\."\n echomsg v:exception"
\."\n return 1"
\."\n endtry"
\."\n return 0"
return r
endfunction
echomsg ERB()
execute "try"
\."\n call tr()"
\."\n catch"
\."\n echomsg v:exception"
\."\n endtry"

(also attached). If you source it with `vim -u NONE -N -S execute-return-bug.vim` you will see

Vim(echo):E119: Not enough arguments for function: tr
0
Error detected while processing /home/zyx/tmp/vim/execute-return-bug.vim:
line 16:
E119: Not enough arguments for function: tr

while expected to see

Vim(echo):E119: Not enough arguments for function: tr
1
Vim(call):E119: Not enough arguments for function: tr

(note the second line: it contains 1; and the third: it shows caught exception). If I unwrap the script (replace `:execute` calls with the string it executes) then everything works as expected.

execute-return-bug.vim
execute-return-bug.vim

Bram Moolenaar

unread,
Sep 15, 2013, 8:32:21 AM9/15/13
to ZyX, vim...@googlegroups.com
I'll add it in the todo list.

--
hundred-and-one symptoms of being an internet addict:
214. Your MCI "Circle of Friends" are all Hayes-compatible.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages