vim/runtime/syntax/testdir/input/vim9_super_this_keywords2.vim
Doug Kearns 1aa287e048
runtime(vim): Update base-syntax, improve variable matching
- Match variables after operators, including line continuations.
- Match option variables without leading whitespace.
- Explicitly match expression subscripts.
- Match Vim9 variables in LHS of assignments and method calls.
- Match option variables (&option) with a dedicated syntax group like
  environment variables.
- Match list literals, fixes: #5830
- Match :{un}lockvar arguments.
- Match registers and environment variables in :let unpack lists.
- Match lambda expressions
- Match Vim9 scope blocks
- Match variables in :for subject
- Highlight user variables with Normal
- Improve this/super keyword matching, fixes: #15970

closes: #16476

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-02-10 22:00:27 +01:00

63 lines
957 B
VimL

vim9script
# VIM_TEST_SETUP hi link vim9Super Todo
# VIM_TEST_SETUP hi link vim9This Todo
# See: https://github.com/vim/vim/pull/16476#issuecomment-2638191110
class A
var _value: any
def new(value: any)
this._BaseInit(value)
enddef
def _BaseInit(value: any)
this._value = value
enddef
def Value(): any
return this._value
enddef
endclass
class B extends A
def new(value: number)
super._BaseInit(value)
enddef
def Value(): number
echo this
return super._value
enddef
endclass
class C extends A
#### E117
# def new(value: string)
# super(value)
# enddef
#### E1034
# def new(super._value)
# enddef
#### E1034
# def new(value: string)
# super._value = value
# enddef
#### E1356
# def Super(): A
# return super
# enddef
def This(): C
return this
enddef
endclass
echo 1 == A.new(1).Value()
echo 2 == B.new(2).Value()
defcompile C