diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-25 09:10:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-25 09:41:21 +0900 |
| commit | 49d1b168221221b7e810f001d88e16ebc94378fd (patch) | |
| tree | 10ff0f8b4e9b8bb7e8dea4003f2126e9e2c3bf5b /src | |
| parent | 306732e02da5f0d47f44033ec1a3af1a77c5f418 (diff) | |
| download | mruby-49d1b168221221b7e810f001d88e16ebc94378fd.tar.gz mruby-49d1b168221221b7e810f001d88e16ebc94378fd.zip | |
Hash splat `**` should not be ignored.
Implemented by adding `OP_HASHCAT` that merges hashes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/codedump.c | 6 | ||||
| -rw-r--r-- | src/vm.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/codedump.c b/src/codedump.c index 842d40bdf..9174ebe3d 100644 --- a/src/codedump.c +++ b/src/codedump.c @@ -416,7 +416,11 @@ codedump(mrb_state *mrb, mrb_irep *irep) print_lv_a(mrb, irep, a); break; CASE(OP_HASHADD, BB): - printf("OP_HASHADD\tR%d\t%d", a, b); + printf("OP_HASHADD\tR%d\t%d\t", a, b); + print_lv_a(mrb, irep, a); + break; + CASE(OP_HASHCAT, B): + printf("OP_HASHCAT\tR%d\t", a); print_lv_a(mrb, irep, a); break; @@ -2710,6 +2710,11 @@ RETRY_TRY_BLOCK: mrb_gc_arena_restore(mrb, ai); NEXT; } + CASE(OP_HASHCAT, B) { + mrb_hash_merge(mrb, regs[a], regs[a+1]); + mrb_gc_arena_restore(mrb, ai); + NEXT; + } CASE(OP_LAMBDA, BB) c = OP_L_LAMBDA; |
