comparison src/vim9compile.c @ 21937:b931df03adcc v8.2.1518

patch 8.2.1518: Vim9: cannot assign to local option Commit: https://github.com/vim/vim/commit/2e80095501238e0c6b702ac7cdfa2e2b763dba28 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 23 19:34:48 2020 +0200 patch 8.2.1518: Vim9: cannot assign to local option Problem: Vim9: cannot assign to local option. Solution: Skip over "&l:" and "&g:". (closes https://github.com/vim/vim/issues/6749)
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Aug 2020 19:45:03 +0200
parents 8e09827f8bac
children 4343657b49fa
comparison
equal deleted inserted replaced
21936:8303e21ae158 21937:b931df03adcc
4548 4548
4549 if (*var_start == '@') 4549 if (*var_start == '@')
4550 p = var_start + 2; 4550 p = var_start + 2;
4551 else 4551 else
4552 { 4552 {
4553 p = (*var_start == '&' || *var_start == '$') 4553 // skip over the leading "&", "&l:", "&g:" and "$"
4554 ? var_start + 1 : var_start; 4554 p = skip_option_env_lead(var_start);
4555 p = to_name_end(p, TRUE); 4555 p = to_name_end(p, TRUE);
4556 } 4556 }
4557 4557
4558 // "a: type" is declaring variable "a" with a type, not "a:". 4558 // "a: type" is declaring variable "a" with a type, not "a:".
4559 if (is_decl && var_end == var_start + 2 && var_end[-1] == ':') 4559 if (is_decl && var_end == var_start + 2 && var_end[-1] == ':')
4593 emsg(_(e_letunexp)); 4593 emsg(_(e_letunexp));
4594 goto theend; 4594 goto theend;
4595 } 4595 }
4596 cc = *p; 4596 cc = *p;
4597 *p = NUL; 4597 *p = NUL;
4598 opt_type = get_option_value(var_start + 1, &numval, 4598 opt_type = get_option_value(skip_option_env_lead(var_start),
4599 NULL, opt_flags); 4599 &numval, NULL, opt_flags);
4600 *p = cc; 4600 *p = cc;
4601 if (opt_type == -3) 4601 if (opt_type == -3)
4602 { 4602 {
4603 semsg(_(e_unknown_option), var_start); 4603 semsg(_(e_unknown_option), var_start);
4604 goto theend; 4604 goto theend;
5129 else 5129 else
5130 { 5130 {
5131 switch (dest) 5131 switch (dest)
5132 { 5132 {
5133 case dest_option: 5133 case dest_option:
5134 generate_STOREOPT(cctx, name + 1, opt_flags); 5134 generate_STOREOPT(cctx, skip_option_env_lead(name),
5135 opt_flags);
5135 break; 5136 break;
5136 case dest_global: 5137 case dest_global:
5137 // include g: with the name, easier to execute that way 5138 // include g: with the name, easier to execute that way
5138 generate_STORE(cctx, ISN_STOREG, 0, name); 5139 generate_STORE(cctx, ISN_STOREG, 0, name);
5139 break; 5140 break;