Mercurial > vim
comparison src/vim9execute.c @ 24606:a4fda40e0bb9 v8.2.2842
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Commit: https://github.com/vim/vim/commit/f18332fb9e2e4208a97d800f096b02c6681780e7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 7 17:55:55 2021 +0200
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiled
Problem: Vim9: skip argument to searchpair() is not compiled.
Solution: Add VAR_INSTR.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 07 May 2021 18:00:04 +0200 |
parents | 5c456a88f651 |
children | 07b3d21a8b4b |
comparison
equal
deleted
inserted
replaced
24605:f5484f767f70 | 24606:a4fda40e0bb9 |
---|---|
1257 } | 1257 } |
1258 ++ufunc->uf_refcount; | 1258 ++ufunc->uf_refcount; |
1259 return OK; | 1259 return OK; |
1260 } | 1260 } |
1261 | 1261 |
1262 // used for v_instr of typval of VAR_INSTR | |
1263 struct instr_S { | |
1264 ectx_T *instr_ectx; | |
1265 isn_T *instr_instr; | |
1266 }; | |
1267 | |
1262 // used for substitute_instr | 1268 // used for substitute_instr |
1263 typedef struct subs_expr_S { | 1269 typedef struct subs_expr_S { |
1264 ectx_T *subs_ectx; | 1270 ectx_T *subs_ectx; |
1265 isn_T *subs_instr; | 1271 isn_T *subs_instr; |
1266 int subs_status; | 1272 int subs_status; |
1374 getsourceline, &cookie, | 1380 getsourceline, &cookie, |
1375 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) | 1381 DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) |
1376 == FAIL | 1382 == FAIL |
1377 || did_emsg) | 1383 || did_emsg) |
1378 goto on_error; | 1384 goto on_error; |
1385 } | |
1386 break; | |
1387 | |
1388 // push typeval VAR_INSTR with instructions to be executed | |
1389 case ISN_INSTR: | |
1390 { | |
1391 if (GA_GROW(&ectx->ec_stack, 1) == FAIL) | |
1392 return FAIL; | |
1393 tv = STACK_TV_BOT(0); | |
1394 tv->vval.v_instr = ALLOC_ONE(instr_T); | |
1395 if (tv->vval.v_instr == NULL) | |
1396 goto on_error; | |
1397 ++ectx->ec_stack.ga_len; | |
1398 | |
1399 tv->v_type = VAR_INSTR; | |
1400 tv->vval.v_instr->instr_ectx = ectx; | |
1401 tv->vval.v_instr->instr_instr = iptr->isn_arg.instr; | |
1379 } | 1402 } |
1380 break; | 1403 break; |
1381 | 1404 |
1382 // execute :substitute with an expression | 1405 // execute :substitute with an expression |
1383 case ISN_SUBSTITUTE: | 1406 case ISN_SUBSTITUTE: |
3995 done: | 4018 done: |
3996 return OK; | 4019 return OK; |
3997 } | 4020 } |
3998 | 4021 |
3999 /* | 4022 /* |
4023 * Execute the instructions from a VAR_INSTR typeval and put the result in | |
4024 * "rettv". | |
4025 * Return OK or FAIL. | |
4026 */ | |
4027 int | |
4028 exe_typval_instr(typval_T *tv, typval_T *rettv) | |
4029 { | |
4030 ectx_T *ectx = tv->vval.v_instr->instr_ectx; | |
4031 isn_T *save_instr = ectx->ec_instr; | |
4032 int save_iidx = ectx->ec_iidx; | |
4033 int res; | |
4034 | |
4035 ectx->ec_instr = tv->vval.v_instr->instr_instr; | |
4036 res = exec_instructions(ectx); | |
4037 if (res == OK) | |
4038 { | |
4039 *rettv = *STACK_TV_BOT(-1); | |
4040 --ectx->ec_stack.ga_len; | |
4041 } | |
4042 | |
4043 ectx->ec_instr = save_instr; | |
4044 ectx->ec_iidx = save_iidx; | |
4045 | |
4046 return res; | |
4047 } | |
4048 | |
4049 /* | |
4000 * Execute the instructions from an ISN_SUBSTITUTE command, which are in | 4050 * Execute the instructions from an ISN_SUBSTITUTE command, which are in |
4001 * "substitute_instr". | 4051 * "substitute_instr". |
4002 */ | 4052 */ |
4003 char_u * | 4053 char_u * |
4004 exe_substitute_instr(void) | 4054 exe_substitute_instr(void) |
4433 cexpr_get_auname(cer->cer_cmdidx), | 4483 cexpr_get_auname(cer->cer_cmdidx), |
4434 cer->cer_forceit ? "!" : "", | 4484 cer->cer_forceit ? "!" : "", |
4435 cer->cer_cmdline); | 4485 cer->cer_cmdline); |
4436 } | 4486 } |
4437 #endif | 4487 #endif |
4488 break; | |
4489 case ISN_INSTR: | |
4490 { | |
4491 smsg("%s%4d INSTR", pfx, current); | |
4492 list_instructions(" ", iptr->isn_arg.instr, | |
4493 INT_MAX, NULL); | |
4494 msg(" -------------"); | |
4495 } | |
4438 break; | 4496 break; |
4439 case ISN_SUBSTITUTE: | 4497 case ISN_SUBSTITUTE: |
4440 { | 4498 { |
4441 subs_T *subs = &iptr->isn_arg.subs; | 4499 subs_T *subs = &iptr->isn_arg.subs; |
4442 | 4500 |
5223 case VAR_BLOB: | 5281 case VAR_BLOB: |
5224 return tv->vval.v_blob != NULL && tv->vval.v_blob->bv_ga.ga_len > 0; | 5282 return tv->vval.v_blob != NULL && tv->vval.v_blob->bv_ga.ga_len > 0; |
5225 case VAR_UNKNOWN: | 5283 case VAR_UNKNOWN: |
5226 case VAR_ANY: | 5284 case VAR_ANY: |
5227 case VAR_VOID: | 5285 case VAR_VOID: |
5286 case VAR_INSTR: | |
5228 break; | 5287 break; |
5229 } | 5288 } |
5230 return FALSE; | 5289 return FALSE; |
5231 } | 5290 } |
5232 | 5291 |