Yukihiro "Matz" Matsumoto
762f682b80
Allow destructuring in formal arguments.
...
e.g.
```
def m(a,(b,c),d); p [a,b,c,d]; end
m(1,[2,3],4) # => [1,2,3,4]
```
mruby limitation:
Destructured arguments (`b` and `c` in above example) cannot be accessed
from the default expression of optional arguments and keyword arguments,
since actual assignment is done after the evaluation of those default
expressions. Thus:
```
def f(a,(b,c),d=b)
p [a,b,c,d]
end
f(1,[2,3])
```
raises `NoMethodError` for `b` in mruby.
2018-11-25 09:07:49 +09:00
Yukihiro "Matz" Matsumoto
e6b72b2121
Remove redundant rules from parse.y.
2018-11-25 07:30:32 +09:00
Yukihiro "Matz" Matsumoto
ec19c34a20
Fixed a bug in mirb heredoc handling; fix #3989
2018-11-20 10:39:34 +09:00
Yukihiro "Matz" Matsumoto
f1eeaad84a
Stop special treating of \r in the lexer; fix #4132
2018-11-20 09:35:38 +09:00
Yukihiro "Matz" Matsumoto
423f872c84
Need to keep rooms for empty splat; fix #4166
2018-11-19 15:26:19 +09:00
Yukihiro "Matz" Matsumoto
418ad65db4
Fixed a bug in continuous read of target files; ref #4138
...
Line number information in a compiled file was wrong.
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
7e3e8d8ed5
Shrink file name table size to uint16_t; ref #4138
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
61f49690e4
Remove filename&lines from mrb_irep struct.
...
This patch slightly reduce memory consumption (2% for my test).
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto
d9e2532552
Remove reserved symbols for now.
...
It should be done by planned embedded symbols.
2018-11-02 22:58:12 +09:00
take-cheeze
6a6586ca84
Reduce unnecessary symbol table entry
2018-10-29 19:40:33 +09:00
take-cheeze
3248de83b6
Reduce instruction size
2018-10-29 19:17:05 +09:00
take-cheeze
b37b312081
Rename libmruby stuff to avoid confusion
2018-10-29 14:07:16 +09:00
Yukihiro "Matz" Matsumoto
fdd5ce8fac
Fixed a bug caused by too much optimization; fix #4137
2018-10-13 00:31:13 +09:00
Yukihiro "Matz" Matsumoto
d2313aebd6
Fixed broken stack consistency; fix #4135
2018-10-12 23:26:14 +09:00
dearblue
366848996a
Clear terminated space
2018-09-07 22:32:34 +09:00
Yukihiro "Matz" Matsumoto
4cd4c64266
Need to support multiple ** splats in argument list; fix #4106
2018-09-06 14:40:21 +09:00
Yukihiro "Matz" Matsumoto
a657117e4e
Avoid warning in MSVC compilation.
2018-09-01 17:36:35 +09:00
Yukihiro "Matz" Matsumoto
20c0c6330f
Too much peephole optimization in gen_call; fix #4091
...
It causes trouble for safe navigation operator.
2018-09-01 17:14:54 +09:00
Yukihiro "Matz" Matsumoto
75a01af710
Remove consequent OP_RETURN by peephole optimization.
2018-08-30 01:23:17 +09:00
Yukihiro "Matz" Matsumoto
441ff45a51
Merge branch 'node_negate_fix' of https://github.com/ukrainskiysergey/mruby into ukrainskiysergey-node_negate_fix
2018-08-29 13:29:54 +09:00
Yukihiro "Matz" Matsumoto
bc88fc6ed1
Check iseq buffer size before code emission; fix #4090
...
The type of `s->pc` is now `uint16_t` that can be overflowed easily.
Need more checks.
2018-08-29 12:31:48 +09:00
Yukihiro "Matz" Matsumoto
471288f37d
Reduce integer casting warnings.
2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
d79dbd92f9
fixup! New bytecode implementation of mruby VM.
2018-08-25 09:49:20 +09:00
Yukihiro "Matz" Matsumoto
49d1b16822
Hash splat ** should not be ignored.
...
Implemented by adding `OP_HASHCAT` that merges hashes.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
b06dad43fa
Remove unused NODE_* constants from node.h.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
e5eb7ef046
Add NODE_KW_HASH support in mrb_parser_dump().
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
162243d95c
Remove arg_value from parse.y.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
eeb6d5658d
New bytecode implementation of mruby VM.
2018-08-25 09:41:21 +09:00
Ukrainskiy Sergey
fbe876b871
Added push() after OP_SEND
2018-08-10 06:44:19 +09:00
Ukrainskiy Sergey
672110dbe8
Small fix
2018-08-09 17:57:18 +09:00
Ukrainskiy Sergey
e3b181586c
Fix weird behavior of the NODE_NEGATE
2018-08-09 17:31:57 +09:00
Yukihiro "Matz" Matsumoto
beb6e5c299
Bytecode support for mrdb.
2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto
8c9e712784
Keyword argument implemented.
2018-07-30 22:58:01 +09:00
Yukihiro "Matz" Matsumoto
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +09:00
yuri
5fef38e4c7
move mrb_irep_remove_lv to codegen.c in mruby-compiler
2018-07-10 15:44:25 +09:00
take-cheeze
dfddc6a09f
Fix dependencies.
2018-06-20 18:21:33 +09:00
take-cheeze
e050cfb349
Add forgotten mkdir_ps.
2018-06-20 18:20:26 +09:00
Yukihiro "Matz" Matsumoto
028e34d345
Update MRB_FLO_TO_STR_FMT to "%.16g"; fix #4016
2018-05-01 17:21:01 +09:00
Yukihiro "Matz" Matsumoto
a8122a9d56
Fix stack position in multiple assignment; fix #4008
...
This was caused by a patch from #2684 .
2018-05-01 12:25:04 +09:00
Yukihiro "Matz" Matsumoto
4790f28d62
Resolve conflicts between labels and conditional ternary; fix #3931
2018-02-12 09:28:09 +09:00
Yukihiro "Matz" Matsumoto
7a116f27e4
Need to determine IS_LABEL_POSSIBLE() properly.
...
Otherwise, `{"a": 1}` will cause `SyntaxError`.
2018-02-10 17:17:36 +09:00
Yukihiro "Matz" Matsumoto
ec63b1a0e0
Limit size of iseq buffer; fix #3927
2018-01-16 15:17:56 +09:00
Yukihiro "Matz" Matsumoto
ca837b1a24
Allow -> do rescue; end as well as proc do rescue; end [Ruby2.6]
2018-01-16 15:08:51 +09:00
Lothar Scholz
06f90a3b45
Make source compilable with C++17
...
Changes applied:
- Removing "register" keyword
- Fixing const pointer to pointer assignments
- Adding type casts to rb_malloc calls
2017-12-23 01:10:43 +01:00
Yukihiro "Matz" Matsumoto
05129ab9b3
Check if destinations are too distant; fix #3900 fix #3901
2017-12-15 17:57:45 +09:00
Yukihiro "Matz" Matsumoto
7ae20e0785
Simplify MRB_WITHOUT_FLOAT condtion
2017-11-08 08:45:59 +09:00
YAMAMOTO Masaya
625f9f6fa3
Merge branch 'master' of github.com:mruby/mruby
2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto
93f5f22577
Heavily refactored how lexical scope links are implemented; fix #3821
...
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.
This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto
07cf7b16f3
Add some peephole optimizations
2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto
e59ad60327
do/end blocks to work with rescue/ensure/else; CRuby2.5
2017-10-17 08:17:31 +09:00