codegen.c: generate `OP_SETIDX` from attribute assignments.

parent cda4d9bc
......@@ -1888,7 +1888,12 @@ gen_assignment(codegen_scope *s, node *tree, node *rhs, int sp, int val)
genop_2(s, OP_ARYPUSH, cursp(), 1);
}
s->sp = call;
genop_3(s, noself ? OP_SSEND : OP_SEND, cursp(), new_sym(s, attrsym(s, mid)), n);
if (mid == MRB_OPSYM_2(s->mrb, aref) && n == 2) {
genop_1(s, OP_SETIDX, cursp());
}
else {
genop_3(s, noself ? OP_SSEND : OP_SEND, cursp(), new_sym(s, attrsym(s, mid)), n);
}
if (safe) {
dispatch(s, skip);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment