Unverified Commit 696589cf authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5628 from dearblue/super-kwargs

Fixing keyword arguments with `super`
parents b1fc0dd5 55b2e45a
......@@ -2854,8 +2854,8 @@ codegen(codegen_scope *s, node *tree, int val)
if (s2 && (s2->ainfo & 0x1) && tree->cdr->car) {
nk = gen_hash(s, tree->cdr->car->cdr, VAL, 14);
if (nk < 0) {st++; nk = 15;}
else st += nk;
n |= 15<<4;
else st += nk*2;
n |= nk<<4;
}
/* block arguments */
if (tree->cdr->cdr) {
......
......@@ -1729,6 +1729,16 @@ RETRY_TRY_BLOCK:
}
mrb_assert(bidx < irep->nregs);
uint8_t nk = (b >> 4) & 0x0f;
if (nk > 0 && nk < CALL_MAXARGS) { /* pack keyword arguments */
uint8_t n = b & 0x0f;
mrb_int kidx = a+(n==15?1:n)+1;
mrb_value kdict = hash_new_from_values(mrb, nk, regs+kidx);
regs[kidx] = kdict;
nk = 15;
b = n | (nk<<4);
}
if (mid == 0 || !target_class) {
mrb_value exc = mrb_exc_new_lit(mrb, E_NOMETHOD_ERROR, "super called outside of method");
mrb_exc_set(mrb, exc);
......
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