Skip to content

Commit

Permalink
Check for super using OP_ARGARY; fix #3678
Browse files Browse the repository at this point in the history
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 a893877
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a893877

Please sign in to comment.