summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--eval.c19
-rw-r--r--parse.y2
3 files changed, 11 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 0646a1e4c6..a9fa274bb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,13 @@ Sat Sep 2 12:00:32 2006 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
instead of String#[](idx) to check utf BOM. follows String#[](idx)
behavior change of 1.9.
+Sat Sep 2 11:47:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should handle when in else clause. a patch
+ from Eric Hodel <drbrain at segment7.net>. [ruby-core:08662]
+
+ * parse.y (primary): wrap with NODE_CASE. [ruby-core:08663]
+
Fri Sep 1 22:07:04 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ruby.h (RSTRING_EMBED_LEN_MASK): uses 5 bits to support 64bit
diff --git a/eval.c b/eval.c
index c24728da47..bd85e331f2 100644
--- a/eval.c
+++ b/eval.c
@@ -2861,25 +2861,12 @@ rb_eval(VALUE self, NODE *n)
}
goto again;
- case NODE_WHEN:
- while (node) {
- if (nd_type(node) != NODE_WHEN) goto again;
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node->nd_head, self,
- ruby_frame->this_func,
- ruby_frame->this_class);
- if (when_check(node->nd_head, Qundef, self)) {
- node = node->nd_body;
- goto again;
- }
- node = node->nd_next;
- }
- RETURN(Qnil);
-
case NODE_CASE:
{
- VALUE val;
+ VALUE val = Qundef;
- val = rb_eval(self, node->nd_head);
+ if (node->nd_head)
+ val = rb_eval(self, node->nd_head);
node = node->nd_body;
while (node) {
if (nd_type(node) != NODE_WHEN) {
diff --git a/parse.y b/parse.y
index 49756f1902..d1984259bd 100644
--- a/parse.y
+++ b/parse.y
@@ -2605,7 +2605,7 @@ primary : literal
| keyword_case opt_terms case_body keyword_end
{
/*%%%*/
- $$ = $3;
+ $$ = NEW_CASE(0, $3);
/*%
$$ = dispatch2(case, Qnil, $3);
%*/