Mercurial > vim
comparison src/filepath.c @ 25356:1cde96e768e4 v8.2.3215
patch 8.2.3215: Vim9: argument types are not checked at compile time
Commit: https://github.com/vim/vim/commit/5bca906b307728fa74a112914dc55b424d512d39
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Jul 24 21:33:26 2021 +0200
patch 8.2.3215: Vim9: argument types are not checked at compile time
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. Sort the argument lists.
(Yegappan Lakshmanan, closes #8626)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Jul 2021 21:45:04 +0200 |
parents | e2be9f3c5907 |
children | e8e2c4d33b9b |
comparison
equal
deleted
inserted
replaced
25355:efef27c0f8a0 | 25356:1cde96e768e4 |
---|---|
1600 int i; | 1600 int i; |
1601 int sort = READDIR_SORT_BYTE; | 1601 int sort = READDIR_SORT_BYTE; |
1602 | 1602 |
1603 if (rettv_list_alloc(rettv) == FAIL) | 1603 if (rettv_list_alloc(rettv) == FAIL) |
1604 return; | 1604 return; |
1605 | |
1606 if (in_vim9script() | |
1607 && (check_for_string_arg(argvars, 0) == FAIL | |
1608 || (argvars[1].v_type != VAR_UNKNOWN | |
1609 && check_for_opt_dict_arg(argvars, 2) == FAIL))) | |
1610 return; | |
1611 | |
1605 path = tv_get_string(&argvars[0]); | 1612 path = tv_get_string(&argvars[0]); |
1606 expr = &argvars[1]; | 1613 expr = &argvars[1]; |
1607 | 1614 |
1608 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && | 1615 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && |
1609 readdirex_dict_arg(&argvars[2], &sort) == FAIL) | 1616 readdirex_dict_arg(&argvars[2], &sort) == FAIL) |
1646 int i; | 1653 int i; |
1647 int sort = READDIR_SORT_BYTE; | 1654 int sort = READDIR_SORT_BYTE; |
1648 | 1655 |
1649 if (rettv_list_alloc(rettv) == FAIL) | 1656 if (rettv_list_alloc(rettv) == FAIL) |
1650 return; | 1657 return; |
1658 | |
1659 if (in_vim9script() | |
1660 && (check_for_string_arg(argvars, 0) == FAIL | |
1661 || (argvars[1].v_type != VAR_UNKNOWN | |
1662 && check_for_opt_dict_arg(argvars, 2) == FAIL))) | |
1663 return; | |
1664 | |
1651 path = tv_get_string(&argvars[0]); | 1665 path = tv_get_string(&argvars[0]); |
1652 expr = &argvars[1]; | 1666 expr = &argvars[1]; |
1653 | 1667 |
1654 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && | 1668 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN && |
1655 readdirex_dict_arg(&argvars[2], &sort) == FAIL) | 1669 readdirex_dict_arg(&argvars[2], &sort) == FAIL) |