0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -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:
Bram Moolenaar
2020-07-08 18:30:06 +02:00
parent 002262f4de
commit 0a47e0970a
3 changed files with 22 additions and 1 deletions

View File

@@ -3229,13 +3229,15 @@ find_ex_command(
// "varname[]" is an expression. // "varname[]" is an expression.
// "g:varname" is an expression. // "g:varname" is an expression.
// "varname->expr" is an expression. // "varname->expr" is an expression.
// "varname.expr" is an expression.
// "(..." is an expression. // "(..." is an expression.
// "{..." is an dict expression. // "{..." is an dict expression.
if (*p == '(' if (*p == '('
|| *p == '{' || *p == '{'
|| (*p == '[' && p > eap->cmd) || (*p == '[' && p > eap->cmd)
|| p[1] == ':' || p[1] == ':'
|| (*p == '-' && p[1] == '>')) || (*p == '-' && p[1] == '>')
|| (*p == '.' && ASCII_ISALPHA(p[1])))
{ {
eap->cmdidx = CMD_eval; eap->cmdidx = CMD_eval;
return eap->cmd; return eap->cmd;

View File

@@ -208,6 +208,23 @@ def Test_method_call_linebreak()
CheckScriptSuccess(lines) CheckScriptSuccess(lines)
enddef 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 Test_bar_after_command()
def RedrawAndEcho() def RedrawAndEcho()
let x = 'did redraw' let x = 'did redraw'

View File

@@ -754,6 +754,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 */
/**/
1157,
/**/ /**/
1156, 1156,
/**/ /**/