Check for super using OP_ARGARY; fix #3678

It generates a wasted empty array for each `super` call though.
It should be fixed in the future, if possible.
parent b0f2bc39
......@@ -1939,9 +1939,19 @@ codegen(codegen_scope *s, node *tree, int val)
case NODE_SUPER:
{
codegen_scope *s2 = s;
int lv = 0;
int n = 0, noop = 0, sendv = 0;
push(); /* room for receiver */
while (!s2->mscope) {
lv++;
s2 = s2->prev;
if (!s2) break;
}
genop(s, MKOP_ABx(OP_ARGARY, cursp(), (lv & 0xf)));
push(); push(); /* ARGARY pushes two values */
pop(); pop();
if (tree) {
node *args = tree->car;
if (args) {
......
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