patch 9.1.0378: Vim9: no comments allowed after class vars
Commit:
https://github.com/vim/vim/commit/fe55c31752acae5a02cd5274fb81965fd41bbcc7
Author: Yegappan Lakshmanan <[email protected]>
Date: Sun Apr 28 09:54:09 2024 +0200
patch 9.1.0378: Vim9: no comments allowed after class vars
Problem: Vim9: no comments allowed after class vars
(Christian Robinson, after 9.1.376)
Solution: Allow trailing comments after class vars
(Yegappan Lakshmanan)
closes: #14651
Signed-off-by: Yegappan Lakshmanan <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index bd06c6e28..ed3aac0be 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -103,6 +103,18 @@ def Test_class_basic()
END
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
+ # Comments are allowed after an inline block
+ lines =<< trim END
+ vim9script
+ class Foo
+ static const bar = { # {{{
+ baz: 'qux'
+ } # }}}
+ endclass
+ assert_equal({baz: 'qux'}, Foo.bar)
+ END
+ v9.CheckSourceSuccess(lines)
+
# Try to define a class with the same name as an existing variable
lines =<< trim END
vim9script
diff --git a/src/version.c b/src/version.c
index 71e56a223..be2be7062 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 378,
/**/
377,
/**/
diff --git a/src/vim9class.c b/src/vim9class.c
index 4314b5290..21945fec3 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -137,7 +137,7 @@ parse_member(
(void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end,
&evalarg);
init_arg = skipwhite(init_arg);
- if (*init_arg != NUL)
+ if (*init_arg != NUL && !vim9_comment_start(init_arg))
{
semsg(_(e_trailing_characters_str), init_arg);
return FAIL;
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1s0zSA-0028Eh-Qs%40256bit.org.