0
0
mirror of https://github.com/vim/vim.git synced 2025-11-09 10:37:17 -05:00

patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classes

Problem:  Vim9: Problem with lambda blocks in enums and classes
          (Aliaksei Budavei)
Solution: Support evaluating lambda blocks from a string, skip over
          comments (Yegappan Lakshmanan)

fixes: #14350
closes: #14405

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-04-04 21:42:07 +02:00
committed by Christian Brabandt
parent 4a65391ca2
commit 3fa8f7728a
7 changed files with 115 additions and 3 deletions

View File

@@ -4931,6 +4931,16 @@ def Test_for_empty_line_after_lambda()
v9.CheckSourceSuccess(lines)
enddef
" Test for evaluating a lambda block from a string
def Test_eval_lambda_block()
var lines =<< trim END
vim9script
var Fn = eval("(x: number): number => {\nreturn x * 2\n}")
assert_equal(6, Fn(3))
END
v9.CheckSourceSuccess(lines)
enddef
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new