Mercurial > vim
comparison src/eval.c @ 2772:18ad854f5dcd v7.3.162
updated for version 7.3.162
Problem: No error message when assigning to a list with an index out of
range. (Yukihiro Nakadaira)
Solution: Add the error message.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 21 Apr 2011 14:27:28 +0200 |
parents | 25672ad7f377 |
children | 8bd38abda314 |
comparison
equal
deleted
inserted
replaced
2771:987cd9455925 | 2772:18ad854f5dcd |
---|---|
2792 } | 2792 } |
2793 if (lp->ll_li == NULL) | 2793 if (lp->ll_li == NULL) |
2794 { | 2794 { |
2795 if (lp->ll_range && !lp->ll_empty2) | 2795 if (lp->ll_range && !lp->ll_empty2) |
2796 clear_tv(&var2); | 2796 clear_tv(&var2); |
2797 if (!quiet) | |
2798 EMSGN(_(e_listidx), lp->ll_n1); | |
2797 return NULL; | 2799 return NULL; |
2798 } | 2800 } |
2799 | 2801 |
2800 /* | 2802 /* |
2801 * May need to find the item or absolute index for the second | 2803 * May need to find the item or absolute index for the second |
2809 clear_tv(&var2); | 2811 clear_tv(&var2); |
2810 if (lp->ll_n2 < 0) | 2812 if (lp->ll_n2 < 0) |
2811 { | 2813 { |
2812 ni = list_find(lp->ll_list, lp->ll_n2); | 2814 ni = list_find(lp->ll_list, lp->ll_n2); |
2813 if (ni == NULL) | 2815 if (ni == NULL) |
2816 { | |
2817 if (!quiet) | |
2818 EMSGN(_(e_listidx), lp->ll_n2); | |
2814 return NULL; | 2819 return NULL; |
2820 } | |
2815 lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); | 2821 lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); |
2816 } | 2822 } |
2817 | 2823 |
2818 /* Check that lp->ll_n2 isn't before lp->ll_n1. */ | 2824 /* Check that lp->ll_n2 isn't before lp->ll_n1. */ |
2819 if (lp->ll_n1 < 0) | 2825 if (lp->ll_n1 < 0) |
2820 lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); | 2826 lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); |
2821 if (lp->ll_n2 < lp->ll_n1) | 2827 if (lp->ll_n2 < lp->ll_n1) |
2828 { | |
2829 if (!quiet) | |
2830 EMSGN(_(e_listidx), lp->ll_n2); | |
2822 return NULL; | 2831 return NULL; |
2832 } | |
2823 } | 2833 } |
2824 | 2834 |
2825 lp->ll_tv = &lp->ll_li->li_tv; | 2835 lp->ll_tv = &lp->ll_li->li_tv; |
2826 } | 2836 } |
2827 } | 2837 } |