Permalink
Browse files

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.
  • Loading branch information...
matz committed Jun 1, 2017
1 parent b0f2bc3 commit a893877b0dc62d29dc4b220a95a6d9ee36b3a263
Showing with 10 additions and 0 deletions.
  1. +10 −0 mrbgems/mruby-compiler/core/codegen.c
@@ -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) {

0 comments on commit a893877

Please sign in to comment.