1
0
forked from aniani/vim

patch 9.0.0379: cleaning up after writefile() is a hassle

Problem:    Cleaning up after writefile() is a hassle.
Solution:   Add the 'D' flag to defer deleting the written file.  Very useful
            in tests.
This commit is contained in:
Bram Moolenaar
2022-09-04 15:40:36 +01:00
parent c1eb131c9e
commit 806a273f3c
11 changed files with 254 additions and 85 deletions

View File

@@ -833,6 +833,14 @@ compile_call(
}
}
if (STRCMP(name, "writefile") == 0 && argcount > 2)
{
// May have the "D" flag, reserve a variable for a deferred
// function call.
if (get_defer_var_idx(cctx) == 0)
idx = -1;
}
if (idx >= 0)
res = generate_BCALL(cctx, idx, argcount, argcount_init == 1);
}