1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_eval.c (rb_f_catch): updated rdoc about generalized argument,

and the case without arguments.  [ruby-core:23827]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-06-12 22:06:59 +00:00
parent 63118829d9
commit 6e678a2d9f
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Sat Jun 13 07:06:54 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (rb_f_catch): updated rdoc about generalized argument,
and the case without arguments. [ruby-core:23827]
Sat Jun 13 06:50:31 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Jun 13 06:50:31 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): TimeoutError is * lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): TimeoutError is

View file

@ -1137,11 +1137,11 @@ rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
/* /*
* call-seq: * call-seq:
* throw(symbol [, obj]) * throw(tag [, obj])
* *
* Transfers control to the end of the active +catch+ block * Transfers control to the end of the active +catch+ block
* waiting for _symbol_. Raises +ArgumentError+ if there * waiting for _tag_. Raises +ArgumentError+ if there
* is no +catch+ block for the symbol. The optional second * is no +catch+ block for the _tag_. The optional second
* parameter supplies a return value for the +catch+ block, * parameter supplies a return value for the +catch+ block,
* which otherwise defaults to +nil+. For examples, see * which otherwise defaults to +nil+. For examples, see
* <code>Kernel::catch</code>. * <code>Kernel::catch</code>.
@ -1188,12 +1188,12 @@ rb_throw(const char *tag, VALUE val)
/* /*
* call-seq: * call-seq:
* catch(symbol) {| | block } > obj * catch([arg]) {|tag| block } => obj
* *
* +catch+ executes its block. If a +throw+ is * +catch+ executes its block. If a +throw+ is
* executed, Ruby searches up its stack for a +catch+ block * executed, Ruby searches up its stack for a +catch+ block
* with a tag corresponding to the +throw+'s * with a tag corresponding to the +throw+'s
* _symbol_. If found, that block is terminated, and * _tag_. If found, that block is terminated, and
* +catch+ returns the value given to +throw+. If * +catch+ returns the value given to +throw+. If
* +throw+ is not called, the block terminates normally, and * +throw+ is not called, the block terminates normally, and
* the value of +catch+ is the value of the last expression * the value of +catch+ is the value of the last expression
@ -1215,6 +1215,12 @@ rb_throw(const char *tag, VALUE val)
* 2 * 2
* 1 * 1
* 0 * 0
*
* when _arg_ is given, +catch+ yields it as is, or when no
* _arg_ is given, +catch+ assigns a new unique object to
* +throw+. this is usefull for nested +catch+. _arg_ can
* be an arbitrary object, not only Symbol.
*
*/ */
static VALUE static VALUE