summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 6 insertions, 1 deletions
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);