mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.1.0376: Vim9: Trailing commands after class/enum keywords ignored
Problem: Vim9: Trailing commands after class/enum keywords ignored Solution: Remove EX_TRLBAR keyword from command definition (Yegappan Lakshmanan) closes: #14649 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
340643e977
commit
ac7731895c
@@ -1,4 +1,4 @@
|
|||||||
*cmdline.txt* For Vim version 9.1. Last change: 2023 Dec 09
|
*cmdline.txt* For Vim version 9.1. Last change: 2024 Apr 27
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -650,6 +650,12 @@ followed by another Vim command:
|
|||||||
:[range]!
|
:[range]!
|
||||||
a user defined command without the "-bar" argument |:command|
|
a user defined command without the "-bar" argument |:command|
|
||||||
|
|
||||||
|
and the following |Vim9-script| keywords:
|
||||||
|
:abstract
|
||||||
|
:class
|
||||||
|
:enum
|
||||||
|
:interface
|
||||||
|
|
||||||
Note that this is confusing (inherited from Vi): With ":g" the '|' is included
|
Note that this is confusing (inherited from Vi): With ":g" the '|' is included
|
||||||
in the command, with ":s" it is not.
|
in the command, with ":s" it is not.
|
||||||
|
|
||||||
|
@@ -129,7 +129,7 @@ EXCMD(CMD_aboveleft, "aboveleft", ex_wrongmodifier,
|
|||||||
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM,
|
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_abstract, "abstract", ex_class,
|
EXCMD(CMD_abstract, "abstract", ex_class,
|
||||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_all, "all", ex_all,
|
EXCMD(CMD_all, "all", ex_all,
|
||||||
EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR,
|
EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR,
|
||||||
@@ -357,7 +357,7 @@ EXCMD(CMD_clast, "clast", ex_cc,
|
|||||||
EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG,
|
EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG,
|
||||||
ADDR_UNSIGNED),
|
ADDR_UNSIGNED),
|
||||||
EXCMD(CMD_class, "class", ex_class,
|
EXCMD(CMD_class, "class", ex_class,
|
||||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_close, "close", ex_close,
|
EXCMD(CMD_close, "close", ex_close,
|
||||||
EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||||
@@ -597,7 +597,7 @@ EXCMD(CMD_enew, "enew", ex_edit,
|
|||||||
EX_BANG|EX_TRLBAR,
|
EX_BANG|EX_TRLBAR,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_enum, "enum", ex_class,
|
EXCMD(CMD_enum, "enum", ex_class,
|
||||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_eval, "eval", ex_eval,
|
EXCMD(CMD_eval, "eval", ex_eval,
|
||||||
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||||
@@ -759,7 +759,7 @@ EXCMD(CMD_intro, "intro", ex_intro,
|
|||||||
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_interface, "interface", ex_class,
|
EXCMD(CMD_interface, "interface", ex_class,
|
||||||
EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
EXCMD(CMD_isearch, "isearch", ex_findpat,
|
EXCMD(CMD_isearch, "isearch", ex_findpat,
|
||||||
EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
|
EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
|
||||||
|
@@ -67,6 +67,42 @@ def Test_class_basic()
|
|||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo 'done'", 3)
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo 'done'", 3)
|
||||||
|
|
||||||
|
# Additional command after "class name"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
class Something | var x = 10
|
||||||
|
endclass
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2)
|
||||||
|
|
||||||
|
# Additional command after "object variable"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
class Something
|
||||||
|
var l: list<number> = [] | var y = 10
|
||||||
|
endclass
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
|
||||||
|
|
||||||
|
# Additional command after "class variable"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
class Something
|
||||||
|
static var d = {a: 10} | var y = 10
|
||||||
|
endclass
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
|
||||||
|
|
||||||
|
# Additional command after "object method"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
class Something
|
||||||
|
def Foo() | var y = 10
|
||||||
|
enddef
|
||||||
|
endclass
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
|
||||||
|
|
||||||
# Try to define a class with the same name as an existing variable
|
# Try to define a class with the same name as an existing variable
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
@@ -2237,6 +2273,14 @@ def Test_interface_basics()
|
|||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an interface: return 5', 6)
|
v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an interface: return 5', 6)
|
||||||
|
|
||||||
|
# Additional commands after "interface name"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
interface Something | var x = 10 | var y = 20
|
||||||
|
endinterface
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2)
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
export interface EnterExit
|
export interface EnterExit
|
||||||
@@ -3233,6 +3277,14 @@ def Test_abstract_class()
|
|||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 script', 1)
|
v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 script', 1)
|
||||||
|
|
||||||
|
# Additional commands after "abstract class"
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
abstract class Something | var x = []
|
||||||
|
endclass
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = []", 2)
|
||||||
|
|
||||||
# Abstract class cannot have a "new" function
|
# Abstract class cannot have a "new" function
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@@ -97,7 +97,16 @@ def Test_enum_parse()
|
|||||||
vim9script
|
vim9script
|
||||||
enum Something | endenum
|
enum Something | endenum
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1420: Missing :endenum', 3)
|
v9.CheckSourceFailure(lines, 'E488: Trailing characters: | endenum', 2)
|
||||||
|
|
||||||
|
# another command follows the enum name
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
enum Something | var x = 10
|
||||||
|
Foo
|
||||||
|
endenum
|
||||||
|
END
|
||||||
|
v9.CheckSourceFailure(lines, 'E488: Trailing characters: | var x = 10', 2)
|
||||||
|
|
||||||
# Try to define an enum with the same name as an existing variable
|
# Try to define an enum with the same name as an existing variable
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
|
@@ -172,6 +172,14 @@ def Test_typealias()
|
|||||||
END
|
END
|
||||||
v9.CheckSourceSuccess(lines)
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
|
# another command follows a type alias
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
type MyType = number | var x = 20
|
||||||
|
assert_equal(20, x)
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
# Sourcing a script twice (which will free script local variables)
|
# Sourcing a script twice (which will free script local variables)
|
||||||
# Uses "lines" from the previous test
|
# Uses "lines" from the previous test
|
||||||
new
|
new
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
376,
|
||||||
/**/
|
/**/
|
||||||
375,
|
375,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -136,6 +136,13 @@ parse_member(
|
|||||||
fill_evalarg_from_eap(&evalarg, eap, FALSE);
|
fill_evalarg_from_eap(&evalarg, eap, FALSE);
|
||||||
(void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end, &evalarg);
|
(void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end, &evalarg);
|
||||||
|
|
||||||
|
init_arg = skipwhite(init_arg);
|
||||||
|
if (*init_arg != NUL)
|
||||||
|
{
|
||||||
|
semsg(_(e_trailing_characters_str), init_arg);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
// No type specified for the member. Set it to "any" and the correct
|
// No type specified for the member. Set it to "any" and the correct
|
||||||
// type will be set when the object is instantiated.
|
// type will be set when the object is instantiated.
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
|
Reference in New Issue
Block a user