Hiroshi Mimaki
716e7b815f
Fixed missing comma in mruby/mirb usage.
2018-12-11 09:37:23 +09:00
Hiroshi Mimaki
e3ae0e4f29
Merge branch 'master' into stable
2018-11-27 09:09:20 +09:00
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
7ed9bb3bd3
Fix wrong number of arguments in Array#fetch; fix #4170
2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto
e2e6554b56
Protect from exceptions raised outside of mrb_vm_run().
...
It can happen if signals are used (e.g. from `mruby-alarm` gem).
2018-11-25 06:05:07 +09:00
Hiroshi Mimaki
0711c861ca
Fix mruby-socket test failure on MinGW.
2018-11-22 09:49:00 +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
9516731329
Use type checking mrb_to_str instead of converting mrb_str_to_str.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
610bcc88c2
Removed to_hash conversion method.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
698f5f707c
Removed to_ary conversion method.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
5bbcea9b3b
Removed try_convert method from Array and Hash.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
b5d43a16a3
Removed String#try_convert method from mruby-string-ext gem.
...
Because `try_convert` method rarely used in production. For mruby users,
we have `__to_str` utility method to check string type.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
ff08856fe3
Remove implicit conversion using to_str method; fix #3854
...
We have added internal convenience method `__to_str` which
does string type check.
The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
2018-11-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto
426c1f9e0b
fix non-ASCII comment.
2018-11-19 11:28:03 +09:00
Yukihiro "Matz" Matsumoto
0a0cc5a217
Check method existence for Enumerators; fix #3920
...
The issue #3920 was fixed but the fundamental flaw of lack of stack
depth check along with fibers still remains, even though it's not
easy to cause the issue. Use `MRB_GC_FIXED_ARENA` to avoid the issue
for workaround.
After this patch, `obj.to_enum` raises `ArgumentError` if the object
does not respond to the enumerating method. This is incompatible to
CRuby but I think this behavior is better and CRuby should be updated
to behave like this.
2018-11-19 10:57:07 +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
485955eccc
String#{squeeze,delete,count} to use bitmap for matching; ref #4163
2018-11-15 04:51:27 +09:00
Yukihiro "Matz" Matsumoto
4550f4e381
Pattern length may overflow uint16_t; fixed #4163
...
The issue is reported by `https://hackerone.com/dgaletic `.
2018-11-15 02:03:54 +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
Yukihiro "Matz" Matsumoto
9c5e28646b
Merge pull request #4151 from take-cheeze/remove_op_symidx
...
Reduce instruction size
2018-11-02 22:37:47 +09:00
Yukihiro "Matz" Matsumoto
f2084f300b
Add tests for empty patterns for tr and count; #4156 #4157
2018-11-02 08:58:21 +09:00
Yukihiro "Matz" Matsumoto
8e59695625
Empty pattern string for String#tr should remove characters; fix #4157
2018-11-02 08:55:17 +09:00
Yukihiro "Matz" Matsumoto
65b04066a2
Empty pattern string can generate TR_UNINITIALIZED pattern; fix #4156
2018-11-02 08:54:24 +09:00
Yukihiro "Matz" Matsumoto
7ad53273a2
Silence Appveyor's VC compilation warnings.
2018-11-01 22:52:12 +09:00
Yukihiro "Matz" Matsumoto
cca5e0977c
VS 2017 C does not understand inline struct initialization; ref #4153
2018-10-30 09:01: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
Yukihiro "Matz" Matsumoto
eebb56713e
Merge pull request #4149 from take-cheeze/static_tr_pattern
...
Keep `tr_pattern` static if possible
2018-10-29 15:34:07 +09:00
Yukihiro "Matz" Matsumoto
ae5463c9e4
Merge pull request #4148 from take-cheeze/rename_libmruby_stuff
...
Rename `MRuby::Build#libmruby` stuff to avoid confusion
2018-10-29 15:13:24 +09:00
Yukihiro "Matz" Matsumoto
63fade1396
Merge pull request #4147 from take-cheeze/add_missing_dep
...
Add missing dependency of source code generator
2018-10-29 15:12:07 +09:00
take-cheeze
b37b312081
Rename libmruby stuff to avoid confusion
2018-10-29 14:07:16 +09:00
take-cheeze
c240aeada9
Add missing dependency of source code generator
2018-10-29 13:58:57 +09:00
take-cheeze
1b185f08e7
Suppress sleep test script warning
2018-10-29 13:58:25 +09:00
take-cheeze
52d55e6069
Keep tr_pattern static
2018-10-29 13:21:36 +09:00
Yukihiro "Matz" Matsumoto
b3a181aaa1
Fixed a bug in processing OP_EXT? instructions.
...
fix haconiwa/haconiwa#171
2018-10-23 21:10:03 +09:00
Tomoyuki Sahara
91444c4747
replace quicksort with mergesort.
2018-10-18 13:07:47 +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
Yukihiro "Matz" Matsumoto
ab0f4db688
Call uniq! for each union processing in Array#union.
2018-10-12 19:00:14 +09:00
Yukihiro "Matz" Matsumoto
8392578216
Fixed SEGV from eval called form top-level mrb_funcall(); fix #4028
2018-10-02 17:26:43 +09:00
Yukihiro "Matz" Matsumoto
e6841abad6
Fixed a String#squeeze bug in handling iso-8859-1 strings; ref #4127
2018-09-27 21:43:35 +09:00
Yukihiro "Matz" Matsumoto
d78acc7afe
Add index to larger segment lists for performance
2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto
8ffd4e47fb
Use mrb_undef_value for delete mark instead of shifting Hash entry table.
...
That means entry table should be compacted periodically by `sg_compact()`.
2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto
01c2f59e14
Revert "Fix comparisons in str_squeeze."
...
This reverts commit 7b04fcd092 .
The issue was addressed by 9e3cbaa . No longer needed.
2018-09-26 12:35:25 +09:00