patch 9.0.0350: :echowindow does not work in a compiled function
Problem: :echowindow does not work in a compiled function.
Solution: Handle the expression at compile time.
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index be40088..12be156 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -2274,6 +2274,8 @@
echomsg 'some' 'message'
echoconsole 'nothing'
echoerr 'went' .. 'wrong'
+ var local = 'window'
+ echowin 'in' local
enddef
def Test_disassemble_echomsg()
@@ -2289,7 +2291,14 @@
"echoerr 'went' .. 'wrong'\\_s*" ..
'\d PUSHS "wentwrong"\_s*' ..
'\d ECHOERR 1\_s*' ..
- '\d RETURN void',
+ "var local = 'window'\\_s*" ..
+ '\d\+ PUSHS "window"\_s*' ..
+ '\d\+ STORE $0\_s*' ..
+ "echowin 'in' local\\_s*" ..
+ '\d\+ PUSHS "in"\_s*' ..
+ '\d\+ LOAD $0\_s*' ..
+ '\d\+ ECHOWINDOW 2\_s*' ..
+ '\d\+ RETURN void',
res)
enddef
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 5aec8ff..bdefc87 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2011,6 +2011,13 @@
# output goes anywhere
enddef
+def Test_echowindow_cmd()
+ var local = 'local'
+ echowindow 'something' local # comment
+ # output goes in message window
+ popup_clear()
+enddef
+
def Test_for_outside_of_function()
var lines =<< trim END
vim9script