]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command ...
authorAliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Sun, 18 Feb 2024 18:02:14 +0000 (21:02 +0300)
committerGitHub <noreply@github.com>
Sun, 18 Feb 2024 18:02:14 +0000 (19:02 +0100)
commitdfcef890cbdd3ec26de040b2e26d77444dc46862
treecaa5628500d3122ec56454d30af27852900aa52b
parentc86bff1771ed9c340f8f4433ae5530fd6de97980
runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command (#14050)

With the arrival of Vim9 classes, the syntax must allow for
_new_ constructors; multiple constructor definitions are
supported for a class, provided distinct suffix-names are
used.  Currently, the defined constructors match either
vimCommand or vimFunctionError (for any newBar).

For example:
------------------------------------------------------------
vim9script

class Foo
    def new()
    enddef

    def newBar()
    enddef
endclass
------------------------------------------------------------

Since every constructor is required to bear a lower-cased
_new_ prefix name, it should suffice to distinguish them
from functions, and so there are no new highlight or syntax
groups introduced.

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/generator/gen_syntax_vim.vim
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim_new_00.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/vim_new_99.dump [new file with mode: 0644]
runtime/syntax/testdir/input/vim_new.vim [new file with mode: 0644]
runtime/syntax/vim.vim