From f2aabd1802b00ce7d23ab7733874b9a48f7495f0 Mon Sep 17 00:00:00 2001 From: mame Date: Sun, 28 Sep 2008 13:15:34 +0000 Subject: [PATCH] * compile.c (iseq_set_sequence): check duplicated when clauses. [ruby-dev:36616] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ compile.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1f7ada7176..7d3bea9186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Sep 28 22:05:07 2008 Yusuke Endoh + + * compile.c (iseq_set_sequence): check duplicated when clause. + [ruby-dev:36616] + Sun Sep 28 19:04:03 2008 Tadayoshi Funaba * test/date/*.rb: imported a date test suite ruby 1.9 limited ed. diff --git a/compile.c b/compile.c index 4a1fc9c73c..ae93c8e135 100644 --- a/compile.c +++ b/compile.c @@ -1349,7 +1349,12 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor) rb_compile_error(RSTRING_PTR(iseq->filename), iobj->line_no, "unknown label"); } - rb_hash_aset(map, obj, INT2FIX(lobj->position - (pos+len))); + if (!st_lookup(rb_hash_tbl(map), obj, 0)) { + rb_hash_aset(map, obj, INT2FIX(lobj->position - (pos+len))); + } + else { + rb_warning("duplicated when clause is ignored"); + } } generated_iseq[pos + 1 + j] = map; iseq_add_mark_object(iseq, map);