Patch 8.2.0822

6 views
Skip to first unread message

Bram Moolenaar

unread,
May 25, 2020, 2:34:44 PM5/25/20
to vim...@googlegroups.com

Patch 8.2.0822
Problem: Vim9: code left over from discovery phase.
Solution: Remove the dead code.
Files: src/scriptfile.c, src/proto/scriptfile.pro, src/ex_cmds.h,
src/evalvars.c, src/proto/evalvars.pro, src/ex_docmd.c


*** ../vim-8.2.0821/src/scriptfile.c 2020-05-10 23:11:49.606819444 +0200
--- src/scriptfile.c 2020-05-25 20:12:03.063314942 +0200
***************
*** 998,1005 ****
int error; // TRUE if LF found after CR-LF
#endif
#ifdef FEAT_EVAL
- garray_T lines_ga; // lines read in previous pass
- int use_lines_ga; // next line to get from "lines_ga"
linenr_T breakpoint; // next line with breakpoint or zero
char_u *fname; // name of sourced file
int dbg_tick; // debug_tick when breakpoint was set
--- 998,1003 ----
***************
*** 1019,1042 ****
}

/*
- * Get the grow array to store script lines in.
- */
- garray_T *
- source_get_line_ga(void *cookie)
- {
- return &((struct source_cookie *)cookie)->lines_ga;
- }
-
- /*
- * Set the index to start reading from the grow array with script lines.
- */
- void
- source_use_line_ga(void *cookie)
- {
- ((struct source_cookie *)cookie)->use_lines_ga = 0;
- }
-
- /*
* Return the address holding the debug tick for a source cookie.
*/
int *
--- 1017,1022 ----
***************
*** 1255,1263 ****
cookie.finished = FALSE;

#ifdef FEAT_EVAL
- ga_init2(&cookie.lines_ga, sizeof(char_u *), 200);
- cookie.use_lines_ga = -1;
-
// Check if this script has a breakpoint.
cookie.breakpoint = dbg_find_breakpoint(TRUE, fname_exp, (linenr_T)0);
cookie.fname = fname_exp;
--- 1235,1240 ----
***************
*** 1302,1307 ****
--- 1279,1287 ----
si->sn_version = 1;
current_sctx.sc_sid = sid;

+ // In Vim9 script all script-local variables are removed when reloading
+ // the same script. In legacy script they remain but "const" can be
+ // set again.
ht = &SCRIPT_VARS(sid);
if (is_vim9)
hashtab_free_contents(ht);
***************
*** 1475,1483 ****
vim_free(cookie.nextline);
vim_free(firstline);
convert_setup(&cookie.conv, NULL, NULL);
- #ifdef FEAT_EVAL
- ga_clear_strings(&cookie.lines_ga);
- #endif

if (trigger_source_post)
apply_autocmds(EVENT_SOURCEPOST, fname_exp, fname_exp, FALSE, curbuf);
--- 1455,1460 ----
***************
*** 1733,1763 ****
// one now.
if (sp->finished)
line = NULL;
- #ifdef FEAT_EVAL
- else if (sp->use_lines_ga >= 0)
- {
- // Get a line that was read in ex_vim9script().
- for (;;)
- {
- if (sp->use_lines_ga >= sp->lines_ga.ga_len)
- {
- line = NULL;
- break;
- }
- else
- {
- line = ((char_u **)(sp->lines_ga.ga_data))[sp->use_lines_ga];
- ((char_u **)(sp->lines_ga.ga_data))[sp->use_lines_ga] = NULL;
- ++sp->use_lines_ga;
- if (line != NULL)
- break;
- // Skip NULL lines, they are equivalent to blank lines.
- ++sp->sourcing_lnum;
- }
- }
- SOURCING_LNUM = sp->sourcing_lnum + 1;
- }
- #endif
else if (sp->nextline == NULL)
line = get_one_sourceline(sp);
else
--- 1710,1715 ----
***************
*** 1773,1783 ****

// Only concatenate lines starting with a \ when 'cpoptions' doesn't
// contain the 'C' flag.
! if (line != NULL && do_concat && vim_strchr(p_cpo, CPO_CONCAT) == NULL
! #ifdef FEAT_EVAL
! && sp->use_lines_ga < 0
! #endif
! )
{
// compensate for the one line read-ahead
--sp->sourcing_lnum;
--- 1725,1731 ----

// Only concatenate lines starting with a \ when 'cpoptions' doesn't
// contain the 'C' flag.
! if (line != NULL && do_concat && vim_strchr(p_cpo, CPO_CONCAT) == NULL)
{
// compensate for the one line read-ahead
--sp->sourcing_lnum;
*** ../vim-8.2.0821/src/proto/scriptfile.pro 2020-05-09 22:50:04.751323784 +0200
--- src/proto/scriptfile.pro 2020-05-25 20:12:07.031303232 +0200
***************
*** 19,26 ****
void ex_source(exarg_T *eap);
void ex_options(exarg_T *eap);
linenr_T *source_breakpoint(void *cookie);
- garray_T *source_get_line_ga(void *cookie);
- void source_use_line_ga(void *cookie);
int *source_dbg_tick(void *cookie);
int source_level(void *cookie);
int do_source(char_u *fname, int check_other, int is_vimrc, int *ret_sid);
--- 19,24 ----
*** ../vim-8.2.0821/src/ex_cmds.h 2020-05-24 23:00:06.444196001 +0200
--- src/ex_cmds.h 2020-05-25 20:26:35.140468329 +0200
***************
*** 396,402 ****
EXCMD(CMD_confirm, "confirm", ex_wrongmodifier,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN,
ADDR_NONE),
! EXCMD(CMD_const, "const", ex_const,
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN,
ADDR_NONE),
EXCMD(CMD_copen, "copen", ex_copen,
--- 396,402 ----
EXCMD(CMD_confirm, "confirm", ex_wrongmodifier,
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN,
ADDR_NONE),
! EXCMD(CMD_const, "const", ex_let,
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN,
ADDR_NONE),
EXCMD(CMD_copen, "copen", ex_copen,
*** ../vim-8.2.0821/src/evalvars.c 2020-05-24 23:14:20.053504523 +0200
--- src/evalvars.c 2020-05-25 20:25:59.552649357 +0200
***************
*** 164,170 ****
// for VIM_VERSION_ defines
#include "version.h"

- static void ex_let_const(exarg_T *eap);
static char_u *skip_var_one(char_u *arg, int include_type);
static void list_glob_vars(int *first);
static void list_buf_vars(int *first);
--- 164,169 ----
***************
*** 682,708 ****
* ":let [var1, var2] = expr" unpack list.
* ":let var =<< ..." heredoc
* ":let var: string" Vim9 declaration
! */
! void
! ex_let(exarg_T *eap)
! {
! ex_let_const(eap);
! }
!
! /*
* ":const" list all variable values
* ":const var1 var2" list variable values
* ":const var = expr" assignment command.
* ":const [var1, var2] = expr" unpack list.
*/
void
! ex_const(exarg_T *eap)
! {
! ex_let_const(eap);
! }
!
! static void
! ex_let_const(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *expr = NULL;
--- 681,694 ----
* ":let [var1, var2] = expr" unpack list.
* ":let var =<< ..." heredoc
* ":let var: string" Vim9 declaration
! *
* ":const" list all variable values
* ":const var1 var2" list variable values
* ":const var = expr" assignment command.
* ":const [var1, var2] = expr" unpack list.
*/
void
! ex_let(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *expr = NULL;
*** ../vim-8.2.0821/src/proto/evalvars.pro 2020-05-24 23:00:06.440196016 +0200
--- src/proto/evalvars.pro 2020-05-25 20:26:44.076423615 +0200
***************
*** 15,21 ****
void restore_vimvar(int idx, typval_T *save_tv);
list_T *heredoc_get(exarg_T *eap, char_u *cmd, int script_get);
void ex_let(exarg_T *eap);
- void ex_const(exarg_T *eap);
int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon, int var_count, int flags, char_u *op);
char_u *skip_var_list(char_u *arg, int include_type, int *var_count, int *semicolon);
void list_hashtable_vars(hashtab_T *ht, char *prefix, int empty, int *first);
--- 15,20 ----
*** ../vim-8.2.0821/src/ex_docmd.c 2020-05-24 23:00:06.444196001 +0200
--- src/ex_docmd.c 2020-05-25 20:26:16.380563140 +0200
***************
*** 269,275 ****
# define ex_call ex_ni
# define ex_catch ex_ni
# define ex_compiler ex_ni
- # define ex_const ex_ni
# define ex_continue ex_ni
# define ex_debug ex_ni
# define ex_debuggreedy ex_ni
--- 269,274 ----
*** ../vim-8.2.0821/src/version.c 2020-05-25 00:28:29.604712788 +0200
--- src/version.c 2020-05-25 20:29:43.255581144 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 822,
/**/

--
The CIA drives around in cars with the "Intel inside" logo.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages