mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0226: Not able to assign enum values to an enum static variable
Problem: Not able to assign enum values to an enum static variable (zzzyxwvut) Solution: Make it work (Yegappan Lakshmanan) related: #14224 closes: #14329 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
059aeac2be
commit
abedca96ef
@ -964,7 +964,7 @@ def Test_enum_refcount()
|
|||||||
|
|
||||||
enum Star
|
enum Star
|
||||||
Gemini,
|
Gemini,
|
||||||
Orion,
|
Orion
|
||||||
endenum
|
endenum
|
||||||
assert_equal(3, test_refcount(Star))
|
assert_equal(3, test_refcount(Star))
|
||||||
assert_equal(2, test_refcount(Star.Gemini))
|
assert_equal(2, test_refcount(Star.Gemini))
|
||||||
@ -1473,4 +1473,17 @@ def Test_enum_eval()
|
|||||||
v9.CheckSourceSuccess(lines)
|
v9.CheckSourceSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" Test for using "values" in an enum class variable
|
||||||
|
def Test_use_enum_values_in_class_variable()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
enum Dir
|
||||||
|
North, South
|
||||||
|
static const dirs: list<Dir> = Dir.values
|
||||||
|
endenum
|
||||||
|
assert_equal([Dir.North, Dir.South], Dir.dirs)
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
226,
|
||||||
/**/
|
/**/
|
||||||
225,
|
225,
|
||||||
/**/
|
/**/
|
||||||
|
@ -2056,6 +2056,11 @@ early_ret:
|
|||||||
if (enum_parse_values(eap, cl, line, &classmembers,
|
if (enum_parse_values(eap, cl, line, &classmembers,
|
||||||
&num_enum_values, &enum_end) == FAIL)
|
&num_enum_values, &enum_end) == FAIL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (enum_end)
|
||||||
|
// Add the enum "values" class variable.
|
||||||
|
enum_add_values_member(cl, &classmembers, num_enum_values,
|
||||||
|
&type_list);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2368,9 +2373,9 @@ early_ret:
|
|||||||
|
|
||||||
vim_free(theline);
|
vim_free(theline);
|
||||||
|
|
||||||
if (success && is_enum)
|
if (success && is_enum && num_enum_values == 0)
|
||||||
// Add the enum "values" class variable.
|
// Empty enum statement. Add an empty "values" class variable
|
||||||
enum_add_values_member(cl, &classmembers, num_enum_values, &type_list);
|
enum_add_values_member(cl, &classmembers, 0, &type_list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check a few things
|
* Check a few things
|
||||||
|
Loading…
x
Reference in New Issue
Block a user