diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-21 09:15:04 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-21 09:15:04 +0000 |
commit | 817193c46dcbdaec8610ec2354e96c20acd95532 (patch) | |
tree | 4d5592b4393d95e585cdfc90b67b4f564d15f66d /vm_eval.c | |
parent | 4151b2f212539d81276374d0930d76626bbe0df9 (diff) | |
download | ruby-817193c46dcbdaec8610ec2354e96c20acd95532.tar.gz ruby-817193c46dcbdaec8610ec2354e96c20acd95532.tar.xz ruby-817193c46dcbdaec8610ec2354e96c20acd95532.zip |
merges r23675 from trunk into ruby_1_9_1.
--
* vm_eval.c (rb_f_catch): updated rdoc about generalized argument,
and the case without arguments. [ruby-core:23827]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1138,11 +1138,11 @@ NORETURN(static VALUE rb_f_throw _((int, VALUE *))); /* * call-seq: - * throw(symbol [, obj]) + * throw(tag [, obj]) * * Transfers control to the end of the active +catch+ block - * waiting for _symbol_. Raises +ArgumentError+ if there - * is no +catch+ block for the symbol. The optional second + * waiting for _tag_. Raises +ArgumentError+ if there + * is no +catch+ block for the _tag_. The optional second * parameter supplies a return value for the +catch+ block, * which otherwise defaults to +nil+. For examples, see * <code>Kernel::catch</code>. @@ -1198,12 +1198,12 @@ rb_throw_obj(VALUE tag, VALUE val) /* * call-seq: - * catch(symbol) {| | block } > obj + * catch([arg]) {|tag| block } => obj * * +catch+ executes its block. If a +throw+ is * executed, Ruby searches up its stack for a +catch+ block * 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 * +throw+ is not called, the block terminates normally, and * the value of +catch+ is the value of the last expression @@ -1225,6 +1225,12 @@ rb_throw_obj(VALUE tag, VALUE val) * 2 * 1 * 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 |