mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.1986: Vim9: accepting type-annotations
Problem: Vim9: accepting type-annotations Solution: Reject type annotations outside of declarations. closes: #13267 closes: #13283 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
committed by
Christian Brabandt
parent
b6d01f131c
commit
b5a0719cb7
@@ -1737,11 +1737,14 @@ compile_lhs(
|
||||
if (is_decl)
|
||||
{
|
||||
// if we come here with what looks like an assignment like
|
||||
// .= but which has been reject by assignment_len() from
|
||||
// .= but which has been rejected by assignment_len() from
|
||||
// may_compile_assignment give a better error message
|
||||
char_u *p = skipwhite(lhs->lhs_end);
|
||||
if (p[0] == '.' && p[1] == '=')
|
||||
emsg(_(e_dot_equal_not_supported_with_script_version_two));
|
||||
else if (p[0] == ':')
|
||||
// type specified in a non-var assignment
|
||||
semsg(_(e_trailing_characters_str), p);
|
||||
else
|
||||
semsg(_(e_variable_already_declared_str), lhs->lhs_name);
|
||||
return FAIL;
|
||||
|
Reference in New Issue
Block a user