Mercurial > vim
comparison src/vim9type.c @ 26839:eb6d56ab4858 v8.2.3948
patch 8.2.3948: Vim9: failure with partial with unknown argument count
Commit: https://github.com/vim/vim/commit/cfe3af284a26178f4838df7c7489b2a1edd4c3a1
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 30 13:59:20 2021 +0000
patch 8.2.3948: Vim9: failure with partial with unknown argument count
Problem: Vim9: failure with partial with unknown argument count.
Solution: Do not copy argument types if there aren't any.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Dec 2021 15:00:05 +0100 |
parents | 434eaef2ac62 |
children | 4e77f9961650 |
comparison
equal
deleted
inserted
replaced
26838:01acdfb78d91 | 26839:eb6d56ab4858 |
---|---|
367 { | 367 { |
368 type = get_type_ptr(type_gap); | 368 type = get_type_ptr(type_gap); |
369 if (type == NULL) | 369 if (type == NULL) |
370 return NULL; | 370 return NULL; |
371 *type = *ufunc->uf_func_type; | 371 *type = *ufunc->uf_func_type; |
372 type->tt_argcount -= tv->vval.v_partial->pt_argc; | 372 if (type->tt_argcount >= 0) |
373 type->tt_min_argcount -= tv->vval.v_partial->pt_argc; | |
374 if (type->tt_argcount == 0) | |
375 type->tt_args = NULL; | |
376 else | |
377 { | 373 { |
378 int i; | 374 type->tt_argcount -= tv->vval.v_partial->pt_argc; |
379 | 375 type->tt_min_argcount -= tv->vval.v_partial->pt_argc; |
380 func_type_add_arg_types(type, type->tt_argcount, | 376 if (type->tt_argcount == 0) |
377 type->tt_args = NULL; | |
378 else | |
379 { | |
380 int i; | |
381 | |
382 func_type_add_arg_types(type, type->tt_argcount, | |
381 type_gap); | 383 type_gap); |
382 for (i = 0; i < type->tt_argcount; ++i) | 384 for (i = 0; i < type->tt_argcount; ++i) |
383 type->tt_args[i] = ufunc->uf_func_type->tt_args[ | 385 type->tt_args[i] = ufunc->uf_func_type->tt_args[ |
384 i + tv->vval.v_partial->pt_argc]; | 386 i + tv->vval.v_partial->pt_argc]; |
387 } | |
385 } | 388 } |
386 return type; | 389 return type; |
387 } | 390 } |
388 return ufunc->uf_func_type; | 391 return ufunc->uf_func_type; |
389 } | 392 } |