mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -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
|
||||
@@ -650,6 +650,12 @@ followed by another Vim command:
|
||||
:[range]!
|
||||
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
|
||||
in the command, with ":s" it is not.
|
||||
|
||||
|
@@ -129,7 +129,7 @@ EXCMD(CMD_aboveleft, "aboveleft", ex_wrongmodifier,
|
||||
EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM,
|
||||
ADDR_NONE),
|
||||
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),
|
||||
EXCMD(CMD_all, "all", ex_all,
|
||||
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,
|
||||
ADDR_UNSIGNED),
|
||||
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),
|
||||
EXCMD(CMD_close, "close", ex_close,
|
||||
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,
|
||||
ADDR_NONE),
|
||||
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),
|
||||
EXCMD(CMD_eval, "eval", ex_eval,
|
||||
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,
|
||||
ADDR_NONE),
|
||||
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),
|
||||
EXCMD(CMD_isearch, "isearch", ex_findpat,
|
||||
EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
|
||||
|
@@ -67,6 +67,42 @@ def Test_class_basic()
|
||||
END
|
||||
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
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
@@ -2237,6 +2273,14 @@ def Test_interface_basics()
|
||||
END
|
||||
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
|
||||
vim9script
|
||||
export interface EnterExit
|
||||
@@ -3233,6 +3277,14 @@ def Test_abstract_class()
|
||||
END
|
||||
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
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
|
@@ -97,7 +97,16 @@ def Test_enum_parse()
|
||||
vim9script
|
||||
enum Something | endenum
|
||||
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
|
||||
lines =<< trim END
|
||||
|
@@ -172,6 +172,14 @@ def Test_typealias()
|
||||
END
|
||||
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)
|
||||
# Uses "lines" from the previous test
|
||||
new
|
||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
376,
|
||||
/**/
|
||||
375,
|
||||
/**/
|
||||
|
@@ -136,6 +136,13 @@ parse_member(
|
||||
fill_evalarg_from_eap(&evalarg, eap, FALSE);
|
||||
(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
|
||||
// type will be set when the object is instantiated.
|
||||
if (type == NULL)
|
||||
|
Reference in New Issue
Block a user