File: vim9_super_this_keywords3.vim

package info (click to toggle)
vim 2%3A9.2.0218-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 96,428 kB
  • sloc: ansic: 435,795; cpp: 6,445; makefile: 4,644; sh: 2,569; java: 2,488; xml: 2,099; python: 1,716; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 35; csh: 9; haskell: 1
file content (27 lines) | stat: -rw-r--r-- 527 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
vim9script
# Vim9 this and super keywords
# VIM_TEST_SETUP hi link vim9Super Todo
# VIM_TEST_SETUP hi link vim9This Todo
# See: https://github.com/vim/vim/pull/16476#issuecomment-2635119478


class A
    const _value: number

    def new(this._value)
    enddef

    def K(): func(any): number
        return ((_: any) => this._value)
    enddef
endclass

class B extends A
    def K(): func(any): number
        return ((_: any) => super._value)
    enddef
endclass

echo 1 == A.new(1).K()(null)
echo 2 == B.new(2).K()(null)