Skip to content

Commit 68b750a

Browse files
committed
Update vim9class.{txt,jax}
1 parent 1baea0e commit 68b750a

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

doc/vim9class.jax

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9class.txt* For Vim バージョン 9.1. Last change: 2025 Apr 05
1+
*vim9class.txt* For Vim バージョン 9.1. Last change: 2025 Apr 13
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -1053,6 +1053,21 @@ Note 列挙型内の列挙値の順序が変更されると、その序数の値
10531053
public const ordinal: number
10541054
endclass
10551055
<
1056+
enum には、通常のクラスと同様にオブジェクト変数とメソッドを含めることができる:
1057+
>
1058+
enum Color
1059+
Cyan([0, 255, 255]),
1060+
Magenta([255, 0, 255]),
1061+
Gray([128, 128, 128])
1062+
1063+
var rgb_values: list<number>
1064+
1065+
def Get_RGB(): list<number>
1066+
return this.rgb_values
1067+
enddef
1068+
endenum
1069+
echo Color.Magenta.Get_RGB()
1070+
<
10561071
==============================================================================
10571072

10581073
9. 論理的根拠

en/vim9class.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9class.txt* For Vim version 9.1. Last change: 2025 Apr 05
1+
*vim9class.txt* For Vim version 9.1. Last change: 2025 Apr 13
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1067,6 +1067,22 @@ The above enum definition is equivalent to the following class definition: >
10671067
public const ordinal: number
10681068
endclass
10691069
<
1070+
A enum can contain object variables and methods just like a regular
1071+
class: >
1072+
1073+
enum Color
1074+
Cyan([0, 255, 255]),
1075+
Magenta([255, 0, 255]),
1076+
Gray([128, 128, 128])
1077+
1078+
var rgb_values: list<number>
1079+
1080+
def Get_RGB(): list<number>
1081+
return this.rgb_values
1082+
enddef
1083+
endenum
1084+
echo Color.Magenta.Get_RGB()
1085+
<
10701086
==============================================================================
10711087

10721088
9. Rationale

0 commit comments

Comments
 (0)