codegen.c: skip `OP_ARGARY` before `super` if the method has no arguments.

parent a1027812
...@@ -2853,18 +2853,30 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2853,18 +2853,30 @@ codegen(codegen_scope *s, node *tree, int val)
if (s2 && s2->ainfo > 0) { if (s2 && s2->ainfo > 0) {
ainfo = s2->ainfo; ainfo = s2->ainfo;
} }
genop_2S(s, OP_ARGARY, cursp(), (ainfo<<4)|(lv & 0xf)); if (ainfo > 0) {
push(); push(); push(); /* ARGARY pushes 3 values at most */ genop_2S(s, OP_ARGARY, cursp(), (ainfo<<4)|(lv & 0xf));
pop(); pop(); pop(); push(); push(); push(); /* ARGARY pushes 3 values at most */
/* keyword arguments */ pop(); pop(); pop();
if (ainfo & 0x1) { /* keyword arguments */
n |= CALL_MAXARGS<<4; if (ainfo & 0x1) {
push(); n |= CALL_MAXARGS<<4;
push();
}
/* block argument */
if (tree && tree->cdr && tree->cdr->cdr) {
push();
codegen(s, tree->cdr->cdr, VAL);
}
} }
/* block argument */ else {
if (tree && tree->cdr && tree->cdr->cdr) { /* block argument */
push(); if (tree && tree->cdr && tree->cdr->cdr) {
codegen(s, tree->cdr->cdr, VAL); codegen(s, tree->cdr->cdr, VAL);
}
else {
gen_blkmove(s, 0, lv);
}
n = 0;
} }
s->sp = sp; s->sp = sp;
genop_2(s, OP_SUPER, cursp(), n); genop_2(s, OP_SUPER, cursp(), n);
......
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