mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user