Patch 8.2.3701
Problem: Vim9: invalid LHS is not possible.
Solution: Remove unreachable error message.
Files: src/vim9compile.c
*** ../vim-8.2.3700/src/vim9compile.c 2021-11-28 22:00:08.148081412 +0000
--- src/vim9compile.c 2021-11-29 21:59:06.940951014 +0000
***************
*** 6503,6554 ****
lhs->lhs_member_type = lhs->lhs_type;
if (lhs->lhs_has_index)
{
// Something follows after the variable: "var[idx]" or "var.key".
- // TODO: should we also handle "->func()" here?
if (is_decl)
{
emsg(_(e_cannot_use_index_when_declaring_variable));
return FAIL;
}
! if (var_start[lhs->lhs_varlen] == '['
! || var_start[lhs->lhs_varlen] == '.')
{
! char_u *after = var_start + lhs->lhs_varlen;
! char_u *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);
! if (*p != '[' && *p != '.')
! {
! lhs->lhs_varlen_total = p - var_start;
! break;
! }
! after = p;
}
! 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
! lhs->lhs_member_type = lhs->lhs_type->tt_member;
}
! else
{
! semsg("Not supported yet: %s", var_start);
! return FAIL;
}
}
return OK;
}
--- 6503,6545 ----
lhs->lhs_member_type = lhs->lhs_type;
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".
if (is_decl)
{
emsg(_(e_cannot_use_index_when_declaring_variable));
return FAIL;
}
! // Now: var_start[lhs->lhs_varlen] is '[' or '.'
! // 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);
! if (*p != '[' && *p != '.')
{
! lhs->lhs_varlen_total = p - var_start;
! break;
}
! after = p;
}
! 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
+ lhs->lhs_member_type = lhs->lhs_type->tt_member;
}
return OK;
}
*** ../vim-8.2.3700/src/version.c 2021-11-29 21:12:20.872101791 +0000
--- src/version.c 2021-11-29 21:50:45.574059787 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3701,
/**/
--
Kiss me twice. I'm schizophrenic.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20211129220237.AEB851C4F5E%40moolenaar.net.