comparison src/vim9compile.c @ 19822:fc3cdc819d80 v8.2.0467

patch 8.2.0467: Vim9: some errors are not tested Commit: https://github.com/vim/vim/commit/33fa29cf74ea314f89cfa58ec9ffc2d6781a59d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 28 19:41:33 2020 +0100 patch 8.2.0467: Vim9: some errors are not tested Problem: Vim9: some errors are not tested Solution: Add more tests. Fix that Vim9 script flag is not reset.
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Mar 2020 19:45:04 +0100
parents c1c88b333481
children 6500dcaf8e1a
comparison
equal deleted inserted replaced
19821:54157d9d75c7 19822:fc3cdc819d80
1813 int prev_called_emsg = called_emsg; 1813 int prev_called_emsg = called_emsg;
1814 1814
1815 if (*(*arg + 1) == ':') 1815 if (*(*arg + 1) == ':')
1816 { 1816 {
1817 // load namespaced variable 1817 // load namespaced variable
1818 name = vim_strnsave(*arg + 2, end - (*arg + 2)); 1818 if (end <= *arg + 2)
1819 name = vim_strsave((char_u *)"[empty]");
1820 else
1821 name = vim_strnsave(*arg + 2, end - (*arg + 2));
1819 if (name == NULL) 1822 if (name == NULL)
1820 return FAIL; 1823 return FAIL;
1821 1824
1822 if (**arg == 'v') 1825 if (**arg == 'v')
1823 { 1826 {
1831 } 1834 }
1832 else if (**arg == 's') 1835 else if (**arg == 's')
1833 { 1836 {
1834 res = compile_load_scriptvar(cctx, name, NULL, NULL, error); 1837 res = compile_load_scriptvar(cctx, name, NULL, NULL, error);
1835 } 1838 }
1839 else if (**arg == 'b')
1840 {
1841 semsg("Namespace b: not supported yet: %s", *arg);
1842 goto theend;
1843 }
1844 else if (**arg == 'w')
1845 {
1846 semsg("Namespace w: not supported yet: %s", *arg);
1847 goto theend;
1848 }
1849 else if (**arg == 't')
1850 {
1851 semsg("Namespace t: not supported yet: %s", *arg);
1852 goto theend;
1853 }
1836 else 1854 else
1837 { 1855 {
1838 semsg("Namespace not supported yet: %s", *arg); 1856 semsg("E1075: Namespace not supported: %s", *arg);
1839 goto theend; 1857 goto theend;
1840 } 1858 }
1841 } 1859 }
1842 else 1860 else
1843 { 1861 {
2058 if (get_list_tv(&p, &rettv, FALSE, FALSE) == FAIL) 2076 if (get_list_tv(&p, &rettv, FALSE, FALSE) == FAIL)
2059 p = arg; 2077 p = arg;
2060 } 2078 }
2061 else if (p == arg && *arg == '#' && arg[1] == '{') 2079 else if (p == arg && *arg == '#' && arg[1] == '{')
2062 { 2080 {
2081 // Can be "#{a: 1}->Func()".
2063 ++p; 2082 ++p;
2064 if (eval_dict(&p, &rettv, FALSE, TRUE) == FAIL) 2083 if (eval_dict(&p, &rettv, FALSE, TRUE) == FAIL)
2065 p = arg; 2084 p = arg;
2066 } 2085 }
2067 else if (p == arg && *arg == '{') 2086 else if (p == arg && *arg == '{')
2068 { 2087 {
2069 int ret = get_lambda_tv(&p, &rettv, FALSE); 2088 int ret = get_lambda_tv(&p, &rettv, FALSE);
2070 2089
2090 // Can be "{x -> ret}()".
2091 // Can be "{'a': 1}->Func()".
2071 if (ret == NOTDONE) 2092 if (ret == NOTDONE)
2072 ret = eval_dict(&p, &rettv, FALSE, FALSE); 2093 ret = eval_dict(&p, &rettv, FALSE, FALSE);
2073 if (ret != OK) 2094 if (ret != OK)
2074 p = arg; 2095 p = arg;
2075 } 2096 }
5121 line = skipwhite(ea.cmd + 1); 5142 line = skipwhite(ea.cmd + 1);
5122 continue; 5143 continue;
5123 } 5144 }
5124 5145
5125 // "{" starts a block scope 5146 // "{" starts a block scope
5126 if (*ea.cmd == '{') 5147 // "{'a': 1}->func() is something else
5148 if (*ea.cmd == '{' && ends_excmd(*skipwhite(ea.cmd + 1)))
5127 { 5149 {
5128 line = compile_block(ea.cmd, &cctx); 5150 line = compile_block(ea.cmd, &cctx);
5129 continue; 5151 continue;
5130 } 5152 }
5131 is_ex_command = *ea.cmd == ':'; 5153 is_ex_command = *ea.cmd == ':';