Mercurial > vim
comparison src/testdir/test_vim9_disassemble.vim @ 24222:a2e6029d354e v8.2.2652
patch 8.2.2652: Vim9: can use command modifier without an effect
Commit: https://github.com/vim/vim/commit/fa984418e7becd8e7d6543cd3ea25f605e9ac97f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 25 22:15:28 2021 +0100
patch 8.2.2652: Vim9: can use command modifier without an effect
Problem: Vim9: can use command modifier without an effect.
Solution: Give an error for a misplaced command modifier. Fix error message
number.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Mar 2021 22:30:04 +0100 |
parents | a7a9176bb542 |
children | 7ffc795288dd |
comparison
equal
deleted
inserted
replaced
24221:70ef6b343eee | 24222:a2e6029d354e |
---|---|
1901 enddef | 1901 enddef |
1902 | 1902 |
1903 def s:SilentIf() | 1903 def s:SilentIf() |
1904 silent if 4 == g:five | 1904 silent if 4 == g:five |
1905 silent elseif 4 == g:five | 1905 silent elseif 4 == g:five |
1906 silent endif | 1906 endif |
1907 enddef | 1907 enddef |
1908 | 1908 |
1909 def Test_silent_if() | 1909 def Test_silent_if() |
1910 var res = execute('disass s:SilentIf') | 1910 var res = execute('disass s:SilentIf') |
1911 assert_match('<SNR>\d*_SilentIf\_s*' .. | 1911 assert_match('<SNR>\d*_SilentIf\_s*' .. |
1922 '\d\+ PUSHNR 4\_s*' .. | 1922 '\d\+ PUSHNR 4\_s*' .. |
1923 '\d\+ LOADG g:five\_s*' .. | 1923 '\d\+ LOADG g:five\_s*' .. |
1924 '\d\+ COMPAREANY ==\_s*' .. | 1924 '\d\+ COMPAREANY ==\_s*' .. |
1925 '\d\+ CMDMOD_REV\_s*' .. | 1925 '\d\+ CMDMOD_REV\_s*' .. |
1926 '\d\+ JUMP_IF_FALSE -> \d\+\_s*' .. | 1926 '\d\+ JUMP_IF_FALSE -> \d\+\_s*' .. |
1927 'silent endif\_s*' .. | 1927 'endif\_s*' .. |
1928 '\d\+ RETURN 0', | 1928 '\d\+ RETURN 0', |
1929 res) | 1929 res) |
1930 enddef | 1930 enddef |
1931 | 1931 |
1932 def s:SilentFor() | 1932 def s:SilentFor() |
1933 silent for i in [0] | 1933 silent for i in [0] |
1934 silent endfor | 1934 endfor |
1935 enddef | 1935 enddef |
1936 | 1936 |
1937 def Test_silent_for() | 1937 def Test_silent_for() |
1938 var res = execute('disass s:SilentFor') | 1938 var res = execute('disass s:SilentFor') |
1939 assert_match('<SNR>\d*_SilentFor\_s*' .. | 1939 assert_match('<SNR>\d*_SilentFor\_s*' .. |
1943 '\d PUSHNR 0\_s*' .. | 1943 '\d PUSHNR 0\_s*' .. |
1944 '\d NEWLIST size 1\_s*' .. | 1944 '\d NEWLIST size 1\_s*' .. |
1945 '\d CMDMOD_REV\_s*' .. | 1945 '\d CMDMOD_REV\_s*' .. |
1946 '5 FOR $0 -> 8\_s*' .. | 1946 '5 FOR $0 -> 8\_s*' .. |
1947 '\d STORE $1\_s*' .. | 1947 '\d STORE $1\_s*' .. |
1948 'silent endfor\_s*' .. | 1948 'endfor\_s*' .. |
1949 '\d JUMP -> 5\_s*' .. | 1949 '\d JUMP -> 5\_s*' .. |
1950 '8 DROP\_s*' .. | 1950 '8 DROP\_s*' .. |
1951 '\d RETURN 0\_s*', | 1951 '\d RETURN 0\_s*', |
1952 res) | 1952 res) |
1953 enddef | 1953 enddef |
1954 | 1954 |
1955 def s:SilentWhile() | 1955 def s:SilentWhile() |
1956 silent while g:not | 1956 silent while g:not |
1957 silent endwhile | 1957 endwhile |
1958 enddef | 1958 enddef |
1959 | 1959 |
1960 def Test_silent_while() | 1960 def Test_silent_while() |
1961 var res = execute('disass s:SilentWhile') | 1961 var res = execute('disass s:SilentWhile') |
1962 assert_match('<SNR>\d*_SilentWhile\_s*' .. | 1962 assert_match('<SNR>\d*_SilentWhile\_s*' .. |
1965 '\d LOADG g:not\_s*' .. | 1965 '\d LOADG g:not\_s*' .. |
1966 '\d COND2BOOL\_s*' .. | 1966 '\d COND2BOOL\_s*' .. |
1967 '\d CMDMOD_REV\_s*' .. | 1967 '\d CMDMOD_REV\_s*' .. |
1968 '\d JUMP_IF_FALSE -> 6\_s*' .. | 1968 '\d JUMP_IF_FALSE -> 6\_s*' .. |
1969 | 1969 |
1970 'silent endwhile\_s*' .. | 1970 'endwhile\_s*' .. |
1971 '\d JUMP -> 0\_s*' .. | 1971 '\d JUMP -> 0\_s*' .. |
1972 '6 RETURN 0\_s*', | 1972 '6 RETURN 0\_s*', |
1973 res) | 1973 res) |
1974 enddef | 1974 enddef |
1975 | 1975 |