Mercurial > vim
comparison src/vim9script.c @ 21516:c7b2ce90c2de v8.2.1308
patch 8.2.1308: Vim9: accidentally using "x" causes Vim to exit
Commit: https://github.com/vim/vim/commit/ae616494d77e9930da703d65d12ac0abf6dc425f
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jul 28 20:07:27 2020 +0200
patch 8.2.1308: Vim9: accidentally using "x" causes Vim to exit
Problem: Vim9: accidentally using "x" causes Vim to exit.
Solution: Disallow using ":x" or "xit" in Vim9 script. (closes https://github.com/vim/vim/issues/6399)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 Jul 2020 20:15:07 +0200 |
parents | 8bcd1ee2630b |
children | e17d0b882194 |
comparison
equal
deleted
inserted
replaced
21515:fac76b495cf6 | 21516:c7b2ce90c2de |
---|---|
57 p_cpo = vim_strsave((char_u *)CPO_VIM); | 57 p_cpo = vim_strsave((char_u *)CPO_VIM); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 /* | 61 /* |
62 * When in Vim9 script give an error and return FAIL. | |
63 */ | |
64 int | |
65 not_in_vim9(exarg_T *eap) | |
66 { | |
67 switch (eap->cmdidx) | |
68 { | |
69 case CMD_insert: | |
70 case CMD_append: | |
71 case CMD_change: | |
72 case CMD_xit: | |
73 semsg(_("E1100: Missing :let: %s"), eap->cmd); | |
74 return FAIL; | |
75 default: break; | |
76 } | |
77 return OK; | |
78 } | |
79 | |
80 /* | |
62 * ":export let Name: type" | 81 * ":export let Name: type" |
63 * ":export const Name: type" | 82 * ":export const Name: type" |
64 * ":export def Name(..." | 83 * ":export def Name(..." |
65 * ":export class Name ..." | 84 * ":export class Name ..." |
66 * | |
67 * ":export {Name, ...}" | |
68 */ | 85 */ |
69 void | 86 void |
70 ex_export(exarg_T *eap) | 87 ex_export(exarg_T *eap) |
71 { | 88 { |
72 if (!in_vim9script()) | 89 if (!in_vim9script()) |