summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authordearblue <[email protected]>2021-11-19 22:53:01 +0900
committerdearblue <[email protected]>2021-11-19 22:53:01 +0900
commit6fba0dbece522265f641927ff3716c3718301998 (patch)
tree459f7a5c86bc77de46c9049897ee4744eedc51d7
parent1a1ff6b3ff410ce46c4978cb2ff58dc36868b916 (diff)
downloadmruby-6fba0dbece522265f641927ff3716c3718301998.tar.gz
mruby-6fba0dbece522265f641927ff3716c3718301998.zip
Fixed a discrepancy in `OP_ASET`
There was a discrepancy in the actual behavior, assertions, and documentation. Therefore, I modified it based on the actual behavior.
-rw-r--r--include/mruby/ops.h2
-rw-r--r--src/vm.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/mruby/ops.h b/include/mruby/ops.h
index f62d8cdfa..7f3b77bf6 100644
--- a/include/mruby/ops.h
+++ b/include/mruby/ops.h
@@ -89,7 +89,7 @@ OPCODE(ARYCAT, B) /* ary_cat(R[a],R[a+1]) */
OPCODE(ARYPUSH, BB) /* ary_push(R[a],R[a+1]..R[a+b]) */
OPCODE(ARYDUP, B) /* R[a] = ary_dup(R[a]) */
OPCODE(AREF, BBB) /* R[a] = R[b][c] */
-OPCODE(ASET, BBB) /* R[a][c] = R[b] */
+OPCODE(ASET, BBB) /* R[b][c] = R[a] */
OPCODE(APOST, BBB) /* *R[a],R[a+1]..R[a+c] = R[a][b..] */
OPCODE(INTERN, B) /* R[a] = intern(R[a]) */
OPCODE(SYMBOL, BB) /* R[a] = intern(Pool[b]) */
diff --git a/src/vm.c b/src/vm.c
index 3457ce33c..f6b929ad6 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2669,7 +2669,7 @@ RETRY_TRY_BLOCK:
}
CASE(OP_ASET, BBB) {
- mrb_assert(mrb_type(regs[a]) == MRB_TT_ARRAY);
+ mrb_assert(mrb_type(regs[b]) == MRB_TT_ARRAY);
mrb_ary_set(mrb, regs[b], c, regs[a]);
NEXT;
}