Mercurial > vim
comparison src/vim9compile.c @ 27800:6e5d378919c4 v8.2.4426
patch 8.2.4426: map() function on string and blob does not check types
Commit: https://github.com/vim/vim/commit/c1e6c7bafec1115b690c745a28e1a6338750b137
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 20 18:26:46 2022 +0000
patch 8.2.4426: map() function on string and blob does not check types
Problem: map() function on string and blob does not check argument types at
compile time.
Solution: Check string and blob argument types. Support "0z1234->func()".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Feb 2022 19:30:02 +0100 |
parents | d754ac2f5ac5 |
children | 532a0c5de1ec |
comparison
equal
deleted
inserted
replaced
27799:427501b72e67 | 27800:6e5d378919c4 |
---|---|
2816 } | 2816 } |
2817 | 2817 |
2818 /* | 2818 /* |
2819 * COMMAND after range | 2819 * COMMAND after range |
2820 * 'text'->func() should not be confused with 'a mark | 2820 * 'text'->func() should not be confused with 'a mark |
2821 * 0z1234->func() should not be confused with a zero line number | |
2821 * "++nr" and "--nr" are eval commands | 2822 * "++nr" and "--nr" are eval commands |
2822 * in "$ENV->func()" the "$" is not a range | 2823 * in "$ENV->func()" the "$" is not a range |
2823 */ | 2824 */ |
2824 cmd = ea.cmd; | 2825 cmd = ea.cmd; |
2825 if ((*cmd != '$' || starts_with_colon) | 2826 if ((*cmd != '$' || starts_with_colon) |
2826 && (starts_with_colon || !(*cmd == '\'' | 2827 && (starts_with_colon |
2827 || (cmd[0] != NUL && cmd[0] == cmd[1] | 2828 || !(*cmd == '\'' |
2829 || (cmd[0] == '0' && cmd[1] == 'z') | |
2830 || (cmd[0] != NUL && cmd[0] == cmd[1] | |
2828 && (*cmd == '+' || *cmd == '-'))))) | 2831 && (*cmd == '+' || *cmd == '-'))))) |
2829 { | 2832 { |
2830 ea.cmd = skip_range(ea.cmd, TRUE, NULL); | 2833 ea.cmd = skip_range(ea.cmd, TRUE, NULL); |
2831 if (ea.cmd > cmd) | 2834 if (ea.cmd > cmd) |
2832 { | 2835 { |