mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3058: Vim9: cannot use ternary operator in parenthesis
Problem: Vim9: cannot use ternary operator in parenthesis. Solution: Do not use "==" for a default argument value. (closes #8462)
This commit is contained in:
parent
307dec4567
commit
015cf10311
@ -923,6 +923,13 @@ def Test_call_lambda_args()
|
|||||||
END
|
END
|
||||||
CheckDefAndScriptFailure(lines, 'E1172:')
|
CheckDefAndScriptFailure(lines, 'E1172:')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
var a = 0
|
||||||
|
var b = (a == 0 ? 1 : 2)
|
||||||
|
assert_equal(1, b)
|
||||||
|
END
|
||||||
|
CheckDefAndScriptSuccess(lines)
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
def ShadowLocal()
|
def ShadowLocal()
|
||||||
var one = 1
|
var one = 1
|
||||||
|
@ -266,13 +266,18 @@ get_function_args(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char_u *np;
|
||||||
|
|
||||||
arg = p;
|
arg = p;
|
||||||
p = one_function_arg(p, newargs, argtypes, types_optional,
|
p = one_function_arg(p, newargs, argtypes, types_optional,
|
||||||
evalarg, FALSE, skip);
|
evalarg, FALSE, skip);
|
||||||
if (p == arg)
|
if (p == arg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*skipwhite(p) == '=' && default_args != NULL)
|
// Recognize " = expr" but not " == expr". A lambda can have
|
||||||
|
// "(a = expr" but "(a == expr" is not a lambda.
|
||||||
|
np = skipwhite(p);
|
||||||
|
if (*np == '=' && np[1] != '=' && default_args != NULL)
|
||||||
{
|
{
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
|
|
||||||
|
@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3058,
|
||||||
/**/
|
/**/
|
||||||
3057,
|
3057,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user