Mercurial > vim
comparison src/vim9execute.c @ 24471:baf75c8e1b7b v8.2.2775
patch 8.2.2775: Vim9: wrong line number used for some commands
Commit: https://github.com/vim/vim/commit/c70fe460b09f6182a13e4385f3232df4fdcd0741
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 17 17:59:19 2021 +0200
patch 8.2.2775: Vim9: wrong line number used for some commands
Problem: Vim9: wrong line number used for some commands.
Solution: For :exe, :echo and the like use the line number of the start of
the command. When calling a function set the line number in the
script context.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 17 Apr 2021 18:00:04 +0200 |
parents | 53216e87f21c |
children | 96905804bf5a |
comparison
equal
deleted
inserted
replaced
24470:9e75cdb46bc5 | 24471:baf75c8e1b7b |
---|---|
327 ectx->ec_instr = INSTRUCTIONS(dfunc); | 327 ectx->ec_instr = INSTRUCTIONS(dfunc); |
328 entry = estack_push_ufunc(ufunc, 1); | 328 entry = estack_push_ufunc(ufunc, 1); |
329 if (entry != NULL) | 329 if (entry != NULL) |
330 { | 330 { |
331 // Set the script context to the script where the function was defined. | 331 // Set the script context to the script where the function was defined. |
332 // TODO: save more than the SID? | 332 // Save the current context so it can be restored on return. |
333 entry->es_save_sid = current_sctx.sc_sid; | 333 entry->es_save_sctx = current_sctx; |
334 current_sctx.sc_sid = ufunc->uf_script_ctx.sc_sid; | 334 current_sctx = ufunc->uf_script_ctx; |
335 } | 335 } |
336 | 336 |
337 // Start execution at the first instruction. | 337 // Start execution at the first instruction. |
338 ectx->ec_iidx = 0; | 338 ectx->ec_iidx = 0; |
339 | 339 |
560 --dfunc->df_ufunc->uf_calls; | 560 --dfunc->df_ufunc->uf_calls; |
561 | 561 |
562 // execution context goes one level up | 562 // execution context goes one level up |
563 entry = estack_pop(); | 563 entry = estack_pop(); |
564 if (entry != NULL) | 564 if (entry != NULL) |
565 current_sctx.sc_sid = entry->es_save_sid; | 565 current_sctx = entry->es_save_sctx; |
566 | 566 |
567 if (handle_closure_in_use(ectx, TRUE) == FAIL) | 567 if (handle_closure_in_use(ectx, TRUE) == FAIL) |
568 return FAIL; | 568 return FAIL; |
569 | 569 |
570 // Clear the arguments. | 570 // Clear the arguments. |