Mercurial > vim
comparison src/vim9compile.c @ 24679:80422f66978a v8.2.2878
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Commit: https://github.com/vim/vim/commit/b777da9be8eb421982e567702db3195475383dec
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 22 21:40:39 2021 +0200
patch 8.2.2878: Vim9: for loop list unpack only allows for one "_"
Problem: Vim9: for loop list unpack only allows for one "_".
Solution: Drop the value when the variable is "_". (closes https://github.com/vim/vim/issues/8232)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 May 2021 21:45:02 +0200 |
parents | 661d15592d3c |
children | 34a5329b85aa |
comparison
equal
deleted
inserted
replaced
24678:da49e6130704 | 24679:80422f66978a |
---|---|
7772 goto failed; | 7772 goto failed; |
7773 if (dest != dest_local) | 7773 if (dest != dest_local) |
7774 { | 7774 { |
7775 if (generate_store_var(cctx, dest, opt_flags, vimvaridx, | 7775 if (generate_store_var(cctx, dest, opt_flags, vimvaridx, |
7776 0, 0, type, name) == FAIL) | 7776 0, 0, type, name) == FAIL) |
7777 goto failed; | |
7778 } | |
7779 else if (varlen == 1 && *arg == '_') | |
7780 { | |
7781 // Assigning to "_": drop the value. | |
7782 if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) | |
7777 goto failed; | 7783 goto failed; |
7778 } | 7784 } |
7779 else | 7785 else |
7780 { | 7786 { |
7781 if (lookup_local(arg, varlen, NULL, cctx) == OK) | 7787 if (lookup_local(arg, varlen, NULL, cctx) == OK) |