]> granicus.if.org Git - vim/commitdiff
patch 8.2.0822: Vim9: code left over from discovery phase v8.2.0822
authorBram Moolenaar <Bram@vim.org>
Mon, 25 May 2020 18:33:55 +0000 (20:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 25 May 2020 18:33:55 +0000 (20:33 +0200)
Problem:    Vim9: code left over from discovery phase.
Solution:   Remove the dead code.

src/evalvars.c
src/ex_cmds.h
src/ex_docmd.c
src/proto/evalvars.pro
src/proto/scriptfile.pro
src/scriptfile.c
src/version.c

index a45080b540aefcfd8c2306377a7b16ac1df48f24..e7a1b6d7cecde44617bbd92e5d56d80140e7304f 100644 (file)
@@ -164,7 +164,6 @@ static dict_T               vimvardict;             // Dictionary with v: variables
 // 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);
@@ -682,27 +681,14 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
  * ":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)
+ex_let(exarg_T *eap)
 {
     char_u     *arg = eap->arg;
     char_u     *expr = NULL;
index 2d86c5dc7e6942abd0fc5f06a4acff31b0a7336e..f68c4fd0b2b2b65e2b4bf6837555a638a4723ecf 100644 (file)
@@ -396,7 +396,7 @@ EXCMD(CMD_continue, "continue",     ex_continue,
 EXCMD(CMD_confirm,     "confirm",      ex_wrongmodifier,
        EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN,
        ADDR_NONE),
-EXCMD(CMD_const,       "const",        ex_const,
+EXCMD(CMD_const,       "const",        ex_let,
        EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN,
        ADDR_NONE),
 EXCMD(CMD_copen,       "copen",        ex_copen,
index 3d590e557758e5540d54c4ba1ac3e3054259046d..90f3a6dc2990704a23da4a2d449608ee4a3239bd 100644 (file)
@@ -269,7 +269,6 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name);
 # 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
index 58e922113e79b6068f4c6c1e54678dfb04dc8721..0d2e7b40d0769e0085b8f581f14010195fe087bb 100644 (file)
@@ -15,7 +15,6 @@ void prepare_vimvar(int idx, typval_T *save_tv);
 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);
index 84536ba78eb461557afb341721d5d48ee7159e5a..111e855a74577eb9adb2036904f4d20c22b19974 100644 (file)
@@ -19,8 +19,6 @@ int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file);
 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);
index 7a148a7c8ae4ea07343b0a8b817286d285338b77..f42c3d04b06048bff50549c76b5e4bacd1062586 100644 (file)
@@ -998,8 +998,6 @@ struct source_cookie
     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
@@ -1018,24 +1016,6 @@ source_breakpoint(void *cookie)
     return &((struct source_cookie *)cookie)->breakpoint;
 }
 
-/*
- * 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.
  */
@@ -1255,9 +1235,6 @@ do_source(
     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;
@@ -1302,6 +1279,9 @@ do_source(
        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,9 +1455,6 @@ almosttheend:
     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);
@@ -1733,31 +1710,6 @@ getsourceline(int c UNUSED, void *cookie, int indent UNUSED, int do_concat)
     // 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
@@ -1773,11 +1725,7 @@ getsourceline(int c UNUSED, void *cookie, int indent UNUSED, int do_concat)
 
     // 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
-           )
+    if (line != NULL && do_concat && vim_strchr(p_cpo, CPO_CONCAT) == NULL)
     {
        // compensate for the one line read-ahead
        --sp->sourcing_lnum;
index 2d99068b09a9ae54d3fcca9454d7b4bd4a37ea0f..c120d82f09cc715b8c71f2520a9a7057f18f88ca 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    822,
 /**/
     821,
 /**/