summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 17:35:29 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 17:35:29 +0000
commit4556a9ec654406c1be43a0b0b3bff99e4d0ed3c1 (patch)
treefcc84fd71b35e57a2ca7e4c4aab74458bbdc21d2 /vm.c
parent0e0a8244c3c931129c81b8ff658073c0742b10cb (diff)
* compile.c (compile_array_): refix r37991 remove assertion:
it is true only if type == COMPILE_ARRAY_TYPE_HASH. [ruby-dev:46658] [Bug #7466] * vm.c (m_core_hash_from_ary): add assertion instead of above. * vm.c (m_core_hash_merge_ary): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index ccf21d7..44fbd26 100644
--- a/vm.c
+++ b/vm.c
@@ -1986,6 +1986,7 @@ m_core_hash_from_ary(VALUE self, VALUE ary)
RUBY_DTRACE_HASH_CREATE(RARRAY_LEN(ary), rb_sourcefile(), rb_sourceline());
}
+ assert(RARRAY_LEN(ary) % 2 == 0);
for (i=0; i<RARRAY_LEN(ary); i+=2) {
rb_hash_aset(hash, RARRAY_PTR(ary)[i], RARRAY_PTR(ary)[i+1]);
}
@@ -1998,6 +1999,7 @@ m_core_hash_merge_ary(VALUE self, VALUE hash, VALUE ary)
{
int i;
+ assert(RARRAY_LEN(ary) % 2 == 0);
for (i=0; i<RARRAY_LEN(ary); i+=2) {
rb_hash_aset(hash, RARRAY_PTR(ary)[i], RARRAY_PTR(ary)[i+1]);
}