patch 8.2.3307: Vim9: :echoconsole cannot access local variables
Problem: Vim9: :echoconsole cannot access local variables.
Solution: Handle like other :echo commands. (closes #8708)
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 1530c90..253fe1b 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -1938,6 +1938,7 @@
def s:Echomsg()
echomsg 'some' 'message'
+ echoconsole 'nothing'
echoerr 'went' .. 'wrong'
enddef
@@ -1948,6 +1949,9 @@
'\d PUSHS "some"\_s*' ..
'\d PUSHS "message"\_s*' ..
'\d ECHOMSG 2\_s*' ..
+ "echoconsole 'nothing'\\_s*" ..
+ '\d PUSHS "nothing"\_s*' ..
+ '\d ECHOCONSOLE 1\_s*' ..
"echoerr 'went' .. 'wrong'\\_s*" ..
'\d PUSHS "wentwrong"\_s*' ..
'\d ECHOERR 1\_s*' ..
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 93dce83..2c5e3e7 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2493,10 +2493,11 @@
enddef
def Test_echoerr_cmd()
+ var local = 'local'
try
- echoerr 'something' 'wrong' # comment
+ echoerr 'something' local 'wrong' # comment
catch
- assert_match('something wrong', v:exception)
+ assert_match('something local wrong', v:exception)
endtry
enddef
@@ -2515,6 +2516,12 @@
CheckScriptSuccess(lines)
enddef
+def Test_echoconsole_cmd()
+ var local = 'local'
+ echoconsole 'something' local # comment
+ # output goes anywhere
+enddef
+
def Test_for_outside_of_function()
var lines =<< trim END
vim9script