Skip to content

Commit 637a281

Browse files
authored
Merge pull request #1447 from vim-jp/hh-update-vim9class
Update vim9class.{txt,jax}
2 parents b0300ba + 4538c15 commit 637a281

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

doc/vim9class.jax

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9class.txt* For Vim バージョン 9.1. Last change: 2024 Jan 12
1+
*vim9class.txt* For Vim バージョン 9.1. Last change: 2024 Mar 03
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -704,6 +704,31 @@ Shape, Square および Triangle を使用した上記の例は、オブジェ
704704
*E1330*
705705
"void", "null" および "v:none" 等、一部の型は使用できない。
706706

707+
組み込みオブジェクトメソッド ~
708+
*builtin-object-methods*
709+
|empty()||len()| および |string()| などの一部の組み込み関数はオブジェクトで
710+
使用できる。オブジェクトは、これらの組み込み関数と同じ名前のメソッドを実装し
711+
て、オブジェクト固有の値を返すことができる。
712+
713+
*E1412*
714+
以下の組み込みメソッドがサポートされている:
715+
*object-empty()*
716+
empty() |empty()| 関数によって呼び出され、オブジェクトが空かどうかを確認
717+
する。このメソッドが存在しない場合は、true が返される。このメソッ
718+
ドは引数を受け入れず、真偽値を返す必要がある。
719+
*object-len()*
720+
len() |len()| 関数によって呼び出され、オブジェクトの長さを返す。このメ
721+
ソッドがクラスにない場合はエラーが発生し、ゼロが返される。このメ
722+
ソッドは引数を受け入れず、数値を返す必要がある。
723+
*object-string()*
724+
string() |string()| 関数によって呼び出され、オブジェクトのテキスト表現を取
725+
得する。オブジェクトに対する |:echo| コマンドでも使用される。この
726+
メソッドがクラスにない場合は、組み込みのデフォルトのテキスト表現
727+
が使用される。このメソッドは引数を受け入れず、文字列を返す必要が
728+
ある。
729+
730+
*E1413*
731+
クラスメソッドを組み込みメソッドとして使用することはできない。
707732

708733
インターフェイスの定義 ~
709734
*Interface* *:interface* *:endinterface*

en/vim9class.txt

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9class.txt* For Vim version 9.1. Last change: 2024 Jan 12
1+
*vim9class.txt* For Vim version 9.1. Last change: 2024 Mar 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -710,6 +710,32 @@ The initialization isn't needed, the list is empty by default.
710710
*E1330*
711711
Some types cannot be used, such as "void", "null" and "v:none".
712712

713+
Builtin Object Methods ~
714+
*builtin-object-methods*
715+
Some of the builtin functions like |empty()|, |len()| and |string()| can be
716+
used with an object. An object can implement a method with the same name as
717+
these builtin functions to return an object-specific value.
718+
719+
*E1412*
720+
The following builtin methods are supported:
721+
*object-empty()*
722+
empty() Invoked by the |empty()| function to check whether an object is
723+
empty. If this method is missing, then true is returned. This
724+
method should not accept any arguments and must return a boolean.
725+
*object-len()*
726+
len() Invoked by the |len()| function to return the length of an
727+
object. If this method is missing in the class, then an error is
728+
given and zero is returned. This method should not accept any
729+
arguments and must return a number.
730+
*object-string()*
731+
string() Invoked by the |string()| function to get a textual
732+
representation of an object. Also used by the |:echo| command
733+
for an object. If this method is missing in the class, then a
734+
built-in default textual representation is used. This method
735+
should not accept any arguments and must return a string.
736+
737+
*E1413*
738+
A class method cannot be used as a builtin method.
713739

714740
Defining an interface ~
715741
*Interface* *:interface* *:endinterface*

0 commit comments

Comments
 (0)