forked from aniani/vim
patch 8.2.3701: Vim9: invalid LHS is not possible
Problem: Vim9: invalid LHS is not possible. Solution: Remove unreachable error message.
This commit is contained in:
@@ -753,6 +753,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 */
|
||||||
|
/**/
|
||||||
|
3701,
|
||||||
/**/
|
/**/
|
||||||
3700,
|
3700,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -6503,52 +6503,43 @@ compile_lhs(
|
|||||||
lhs->lhs_member_type = lhs->lhs_type;
|
lhs->lhs_member_type = lhs->lhs_type;
|
||||||
if (lhs->lhs_has_index)
|
if (lhs->lhs_has_index)
|
||||||
{
|
{
|
||||||
|
char_u *after = var_start + lhs->lhs_varlen;
|
||||||
|
char_u *p;
|
||||||
|
|
||||||
// Something follows after the variable: "var[idx]" or "var.key".
|
// Something follows after the variable: "var[idx]" or "var.key".
|
||||||
// TODO: should we also handle "->func()" here?
|
|
||||||
if (is_decl)
|
if (is_decl)
|
||||||
{
|
{
|
||||||
emsg(_(e_cannot_use_index_when_declaring_variable));
|
emsg(_(e_cannot_use_index_when_declaring_variable));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var_start[lhs->lhs_varlen] == '['
|
// Now: var_start[lhs->lhs_varlen] is '[' or '.'
|
||||||
|| var_start[lhs->lhs_varlen] == '.')
|
// Only the last index is used below, if there are others
|
||||||
|
// before it generate code for the expression. Thus for
|
||||||
|
// "ll[1][2]" the expression is "ll[1]" and "[2]" is the index.
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
char_u *after = var_start + lhs->lhs_varlen;
|
p = skip_index(after);
|
||||||
char_u *p;
|
if (*p != '[' && *p != '.')
|
||||||
|
|
||||||
// Only the last index is used below, if there are others
|
|
||||||
// before it generate code for the expression. Thus for
|
|
||||||
// "ll[1][2]" the expression is "ll[1]" and "[2]" is the index.
|
|
||||||
for (;;)
|
|
||||||
{
|
{
|
||||||
p = skip_index(after);
|
lhs->lhs_varlen_total = p - var_start;
|
||||||
if (*p != '[' && *p != '.')
|
break;
|
||||||
{
|
|
||||||
lhs->lhs_varlen_total = p - var_start;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
after = p;
|
|
||||||
}
|
}
|
||||||
if (after > var_start + lhs->lhs_varlen)
|
after = p;
|
||||||
{
|
|
||||||
lhs->lhs_varlen = after - var_start;
|
|
||||||
lhs->lhs_dest = dest_expr;
|
|
||||||
// We don't know the type before evaluating the expression,
|
|
||||||
// use "any" until then.
|
|
||||||
lhs->lhs_type = &t_any;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lhs->lhs_type->tt_member == NULL)
|
|
||||||
lhs->lhs_member_type = &t_any;
|
|
||||||
else
|
|
||||||
lhs->lhs_member_type = lhs->lhs_type->tt_member;
|
|
||||||
}
|
}
|
||||||
|
if (after > var_start + lhs->lhs_varlen)
|
||||||
|
{
|
||||||
|
lhs->lhs_varlen = after - var_start;
|
||||||
|
lhs->lhs_dest = dest_expr;
|
||||||
|
// We don't know the type before evaluating the expression,
|
||||||
|
// use "any" until then.
|
||||||
|
lhs->lhs_type = &t_any;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lhs->lhs_type->tt_member == NULL)
|
||||||
|
lhs->lhs_member_type = &t_any;
|
||||||
else
|
else
|
||||||
{
|
lhs->lhs_member_type = lhs->lhs_type->tt_member;
|
||||||
semsg("Not supported yet: %s", var_start);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user