mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Problem: Vim9: dict.name is not recognized as an expression. Solution: Recognize ".name". (closes #6418)
This commit is contained in:
@@ -3229,13 +3229,15 @@ find_ex_command(
|
||||
// "varname[]" is an expression.
|
||||
// "g:varname" is an expression.
|
||||
// "varname->expr" is an expression.
|
||||
// "varname.expr" is an expression.
|
||||
// "(..." is an expression.
|
||||
// "{..." is an dict expression.
|
||||
if (*p == '('
|
||||
|| *p == '{'
|
||||
|| (*p == '[' && p > eap->cmd)
|
||||
|| p[1] == ':'
|
||||
|| (*p == '-' && p[1] == '>'))
|
||||
|| (*p == '-' && p[1] == '>')
|
||||
|| (*p == '.' && ASCII_ISALPHA(p[1])))
|
||||
{
|
||||
eap->cmdidx = CMD_eval;
|
||||
return eap->cmd;
|
||||
|
@@ -208,6 +208,23 @@ def Test_method_call_linebreak()
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_dict_member()
|
||||
let test: dict<list<number>> = {'data': [3, 1, 2]}
|
||||
test.data->sort()
|
||||
assert_equal(#{data: [1, 2, 3]}, test)
|
||||
test.data
|
||||
->reverse()
|
||||
assert_equal(#{data: [3, 2, 1]}, test)
|
||||
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
let test: dict<list<number>> = {'data': [3, 1, 2]}
|
||||
test.data->sort()
|
||||
assert_equal(#{data: [1, 2, 3]}, test)
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_bar_after_command()
|
||||
def RedrawAndEcho()
|
||||
let x = 'did redraw'
|
||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1157,
|
||||
/**/
|
||||
1156,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user