diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-05-25 12:40:49 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-05-25 12:40:49 +0900 |
| commit | 5e1a6a2cc296dfbe9e311870d24dfcbc0aee1fad (patch) | |
| tree | 3d800b77b3c07191b35dd0746f820313ed3d6061 /mrbgems/mruby-compiler/core/codegen.c | |
| parent | 4566c80d7b8b9b9117128f6b11f7420aae530a86 (diff) | |
| download | mruby-5e1a6a2cc296dfbe9e311870d24dfcbc0aee1fad.tar.gz mruby-5e1a6a2cc296dfbe9e311870d24dfcbc0aee1fad.zip | |
Make `gen_assignment()` to support `NODE_SCALL`; ref #3658
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index d04ff44ba..7acbdaee3 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -956,7 +956,7 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val) int type = (intptr_t)tree->car; tree = tree->cdr; - switch ((intptr_t)type) { + switch (type) { case NODE_GVAR: idx = new_sym(s, sym(tree)); genop_peep(s, MKOP_ABx(OP_SETGLOBAL, sp, idx), val); @@ -1006,8 +1006,10 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val) break; case NODE_CALL: + case NODE_SCALL: push(); - gen_call(s, tree, attrsym(s, sym(tree->cdr->car)), sp, NOVAL, 0); + gen_call(s, tree, attrsym(s, sym(tree->cdr->car)), sp, NOVAL, + type == NODE_SCALL); pop(); if (val) { genop_peep(s, MKOP_AB(OP_MOVE, cursp(), sp), val); |
