Mercurial > vim
comparison src/vim9compile.c @ 26441:65ab0b035dd8 v8.2.3751
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Commit: https://github.com/vim/vim/commit/6409553b6e3b4de4e1d72b8ee5445595214581ff
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Dec 6 11:03:55 2021 +0000
patch 8.2.3751: cannot assign a lambda to an option that takes a function
Problem: Cannot assign a lambda to an option that takes a function.
Solution: Automatically convert the lambda to a string. (Yegappan
Lakshmanan, closes #9286)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 06 Dec 2021 12:15:04 +0100 |
parents | 1bbb884c8561 |
children | ff0310e6f889 |
comparison
equal
deleted
inserted
replaced
26440:f6f5f604c17c | 26441:65ab0b035dd8 |
---|---|
6070 } | 6070 } |
6071 | 6071 |
6072 /* | 6072 /* |
6073 * For one assignment figure out the type of destination. Return it in "dest". | 6073 * For one assignment figure out the type of destination. Return it in "dest". |
6074 * When not recognized "dest" is not set. | 6074 * When not recognized "dest" is not set. |
6075 * For an option "opt_flags" is set. | 6075 * For an option "option_scope" is set. |
6076 * For a v:var "vimvaridx" is set. | 6076 * For a v:var "vimvaridx" is set. |
6077 * "type" is set to the destination type if known, unchanted otherwise. | 6077 * "type" is set to the destination type if known, unchanted otherwise. |
6078 * Return FAIL if an error message was given. | 6078 * Return FAIL if an error message was given. |
6079 */ | 6079 */ |
6080 static int | 6080 static int |
6081 get_var_dest( | 6081 get_var_dest( |
6082 char_u *name, | 6082 char_u *name, |
6083 assign_dest_T *dest, | 6083 assign_dest_T *dest, |
6084 int cmdidx, | 6084 int cmdidx, |
6085 int *opt_flags, | 6085 int *option_scope, |
6086 int *vimvaridx, | 6086 int *vimvaridx, |
6087 type_T **type, | 6087 type_T **type, |
6088 cctx_T *cctx) | 6088 cctx_T *cctx) |
6089 { | 6089 { |
6090 char_u *p; | 6090 char_u *p; |
6100 { | 6100 { |
6101 emsg(_(e_const_option)); | 6101 emsg(_(e_const_option)); |
6102 return FAIL; | 6102 return FAIL; |
6103 } | 6103 } |
6104 p = name; | 6104 p = name; |
6105 p = find_option_end(&p, opt_flags); | 6105 p = find_option_end(&p, option_scope); |
6106 if (p == NULL) | 6106 if (p == NULL) |
6107 { | 6107 { |
6108 // cannot happen? | 6108 // cannot happen? |
6109 emsg(_(e_unexpected_characters_in_assignment)); | 6109 emsg(_(e_unexpected_characters_in_assignment)); |
6110 return FAIL; | 6110 return FAIL; |
6111 } | 6111 } |
6112 cc = *p; | 6112 cc = *p; |
6113 *p = NUL; | 6113 *p = NUL; |
6114 opt_type = get_option_value(skip_option_env_lead(name), | 6114 opt_type = get_option_value(skip_option_env_lead(name), |
6115 &numval, NULL, *opt_flags); | 6115 &numval, NULL, NULL, *option_scope); |
6116 *p = cc; | 6116 *p = cc; |
6117 switch (opt_type) | 6117 switch (opt_type) |
6118 { | 6118 { |
6119 case gov_unknown: | 6119 case gov_unknown: |
6120 semsg(_(e_unknown_option), name); | 6120 semsg(_(e_unknown_option), name); |