summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--parse.y7
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 44d8723bdc..5f9a6e9163 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 16 09:14:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (block_call): block should not be given to yield.
+ [ruby-core:20583]
+
Mon Dec 15 23:48:39 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* thread.c (sleep_timeval): cast tv_usec to long to shut up
diff --git a/parse.y b/parse.y
index 2cf9006104..6983a2cdb2 100644
--- a/parse.y
+++ b/parse.y
@@ -3497,7 +3497,12 @@ do_block : keyword_do_block
block_call : command do_block
{
/*%%%*/
- block_dup_check($1->nd_args, $2);
+ if (nd_type($1) == NODE_YIELD) {
+ compile_error(PARSER_ARG "block given to yield");
+ }
+ else {
+ block_dup_check($1->nd_args, $2);
+ }
$2->nd_iter = $1;
$$ = $2;
fixpos($$, $1);