Mercurial > vim
comparison src/vim9execute.c @ 28934:a712ea475390 v8.2.4989
patch 8.2.4989: cannot specify a function name for :defcompile
Commit: https://github.com/vim/vim/commit/f79d9dd43f6fe05711d7e2616ab4b8bde2ccb089
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 21 15:39:02 2022 +0100
patch 8.2.4989: cannot specify a function name for :defcompile
Problem: Cannot specify a function name for :defcompile.
Solution: Implement a function name argument for :defcompile.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 21 May 2022 16:45:03 +0200 |
parents | 8f599b6d9f54 |
children | b02044bc8c20 |
comparison
equal
deleted
inserted
replaced
28933:57c9377b9c62 | 28934:a712ea475390 |
---|---|
6275 */ | 6275 */ |
6276 void | 6276 void |
6277 ex_disassemble(exarg_T *eap) | 6277 ex_disassemble(exarg_T *eap) |
6278 { | 6278 { |
6279 char_u *arg = eap->arg; | 6279 char_u *arg = eap->arg; |
6280 char_u *fname; | |
6281 ufunc_T *ufunc; | 6280 ufunc_T *ufunc; |
6282 dfunc_T *dfunc; | 6281 dfunc_T *dfunc; |
6283 isn_T *instr; | 6282 isn_T *instr; |
6284 int instr_count; | 6283 int instr_count; |
6285 int is_global = FALSE; | 6284 compiletype_T compile_type; |
6286 compiletype_T compile_type = CT_NONE; | 6285 |
6287 | 6286 ufunc = find_func_by_name(arg, &compile_type); |
6288 if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7])) | 6287 if (ufunc == NULL) |
6289 { | |
6290 compile_type = CT_PROFILE; | |
6291 arg = skipwhite(arg + 7); | |
6292 } | |
6293 else if (STRNCMP(arg, "debug", 5) == 0 && VIM_ISWHITE(arg[5])) | |
6294 { | |
6295 compile_type = CT_DEBUG; | |
6296 arg = skipwhite(arg + 5); | |
6297 } | |
6298 | |
6299 if (STRNCMP(arg, "<lambda>", 8) == 0) | |
6300 { | |
6301 arg += 8; | |
6302 (void)getdigits(&arg); | |
6303 fname = vim_strnsave(eap->arg, arg - eap->arg); | |
6304 } | |
6305 else | |
6306 fname = trans_function_name(&arg, &is_global, FALSE, | |
6307 TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL, NULL); | |
6308 if (fname == NULL) | |
6309 { | |
6310 semsg(_(e_invalid_argument_str), eap->arg); | |
6311 return; | 6288 return; |
6312 } | |
6313 | |
6314 ufunc = find_func(fname, is_global); | |
6315 if (ufunc == NULL) | |
6316 { | |
6317 char_u *p = untrans_function_name(fname); | |
6318 | |
6319 if (p != NULL) | |
6320 // Try again without making it script-local. | |
6321 ufunc = find_func(p, FALSE); | |
6322 } | |
6323 vim_free(fname); | |
6324 if (ufunc == NULL) | |
6325 { | |
6326 semsg(_(e_cannot_find_function_str), eap->arg); | |
6327 return; | |
6328 } | |
6329 if (func_needs_compiling(ufunc, compile_type) | 6289 if (func_needs_compiling(ufunc, compile_type) |
6330 && compile_def_function(ufunc, FALSE, compile_type, NULL) == FAIL) | 6290 && compile_def_function(ufunc, FALSE, compile_type, NULL) == FAIL) |
6331 return; | 6291 return; |
6332 if (ufunc->uf_def_status != UF_COMPILED) | 6292 if (ufunc->uf_def_status != UF_COMPILED) |
6333 { | 6293 { |