diff src/scriptfile.c @ 20536:8fa783f2c69c v8.2.0822

patch 8.2.0822: Vim9: code left over from discovery phase Commit: https://github.com/vim/vim/commit/2eec37926db6d31beb36f162ac00357a30c093c8 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 25 20:33:55 2020 +0200 patch 8.2.0822: Vim9: code left over from discovery phase Problem: Vim9: code left over from discovery phase. Solution: Remove the dead code.
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 May 2020 20:45:04 +0200
parents b0242bcc74e7
children 9f921ba86d05
line wrap: on
line diff
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -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
@@ -1019,24 +1017,6 @@ source_breakpoint(void *cookie)
 }
 
 /*
- * 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 *
@@ -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
     // 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
 
     // 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;