dearblue
fd89948164
Fix empty array refers; ref #4556
...
For example, `"".unpack("")` evaluates to `[]`.
2019-07-14 12:03:44 +09:00
dearblue
4861be1171
Fix pack/unpack for base64; ref #4556
...
The pack/unpack "m" directive should be treated as a length rather than
an element count.
2019-07-14 12:03:00 +09:00
dearblue
109d926e9c
Add pack/unpack test for base64
2019-07-15 10:41:32 +09:00
Yukihiro "Matz" Matsumoto
a7be9f1cab
Merge pull request #4574 from shuujii/add-mruby-method-gem-to-default.gembox
...
Add `mruby-method` gem to `default.gembox` [ci skip]
2019-07-13 21:11:45 +09:00
KOBAYASHI Shuji
e8a84d663f
Add mruby-method gem to default.gembox [ci skip]
2019-07-13 20:42:32 +09:00
Yukihiro "Matz" Matsumoto
b4cdced22f
Enumerable#detect {and #find} should call ifnone; fix #4484
...
It's an error in ISO specification; 15.3.2.2.4 and 15.3.2.2.7
2019-07-13 18:05:01 +09:00
Yukihiro "Matz" Matsumoto
a9fd2e6464
Resolve ambiguous argument warning.
2019-07-13 13:16:30 +09:00
Yukihiro "Matz" Matsumoto
9741df100b
Change type of a variable for signedness mismatch; ref #4573
2019-07-13 13:13:21 +09:00
Yukihiro "Matz" Matsumoto
6b1cc6e2fe
Avoid mrb_funcall() if possible using mrb_Float(); ref #4555
2019-07-13 12:54:02 +09:00
Yukihiro "Matz" Matsumoto
c902e30494
Merge pull request #4571 from shuujii/consider--MP-flag-specified-when-parsing-.d-file
...
Consider `-MP` flag specified when parsing `.d` file
2019-07-12 21:46:35 +09:00
Yukihiro "Matz" Matsumoto
1556371370
Merge pull request #4573 from dearblue/fix-4569
...
Fix heap buffer overflow; fix #4569
2019-07-12 21:46:02 +09:00
dearblue
bde2f35a9f
Fix heap buffer overflow; fix #4569
2019-07-12 21:23:55 +09:00
Yukihiro "Matz" Matsumoto
54712c0624
Merge pull request #4572 from shuujii/lazy-load-tasks-toolchains
...
Lazy load `tasks/toolchains/*.rake`
2019-07-12 19:01:58 +09:00
KOBAYASHI Shuji
16e4657acd
Lazy load tasks/toolchains/*.rake
2019-07-12 18:35:20 +09:00
KOBAYASHI Shuji
66909dfe86
Consider -MP flag specified when parsing .d file
...
`-MP` flag is used in `tasks/toolchains/android.rake`.
2019-07-12 14:23:35 +09:00
Yukihiro "Matz" Matsumoto
c5f0a0256b
Merge pull request #4569 from dearblue/improve-string-index
...
Improve performance `String#index` with UTF-8
2019-07-12 01:47:50 +09:00
dearblue
e4249b1b9e
Add UTF-8 test for String#index
2019-07-11 22:09:16 +09:00
dearblue
8c0d9ba1a3
Improve performance String#index with UTF-8
...
Based on Boyer-Moore-Horspool algorithm (Quick Search algorithm).
As a side effect, the correct position is returned even if an invalid UTF-8
string is given.
```console
% ./mruby@master -e 'p ("\xd1" * 100 + "#").index("#")'
50
% ./mruby@improve-index -e 'p ("\xd1" * 100 + "#").index("#")'
100
```
The other behavior should be the same as the current implementation.
2019-07-11 22:09:15 +09:00
Yukihiro "Matz" Matsumoto
5420895bcb
Merge pull request #4568 from shuujii/remove-an-unused-argument-of-str_with_class
...
Remove an unused argument of `str_with_class()`
2019-07-10 22:33:38 +09:00
KOBAYASHI Shuji
80f78ca196
Remove an unused argument of str_with_class()
2019-07-10 21:53:17 +09:00
Yukihiro "Matz" Matsumoto
bc7c5d376a
Merge pull request #4562 from shuujii/set-MRB_STR_ASCII-flag-when-an-inline-symbol-is-stringized
...
Set `MRB_STR_ASCII` flag when an inline symbol is stringized
2019-07-09 21:22:15 +09:00
KOBAYASHI Shuji
23fc3339ee
Set MRB_STR_ASCII flag when an inline symbol is stringized
2019-07-09 18:59:00 +09:00
Yukihiro "Matz" Matsumoto
59a76d48f8
Merge pull request #4560 from lopopolo/range-max-min-hang
...
Specialize Enumerable#max and Enumerable#min for Range
2019-07-09 18:44:53 +09:00
Ryan Lopopolo
3b77b5fd39
Revert Float dependency in Range#each
2019-07-09 02:08:14 -07:00
Ryan Lopopolo
56929362f5
Fix Range#min fast path with exclusive range
2019-07-09 01:48:15 -07:00
Ryan Lopopolo
0ad5ba7a0f
Add a fast path for Float and Fixnum ranges for Range#max and Range#min
...
If no block is given and the Range has Fixnum or Float endpoints, do not iterate with
each and instead compare the endpoints directly. This implementation passes all of
the applicable specs from Ruby Spec.
2019-07-09 01:42:40 -07:00
Ryan Lopopolo
eab07daf92
Add Range#max and Range#min tests from Ruby Spec
2019-07-09 01:41:10 -07:00
Ryan Lopopolo
d9c5303793
Remove attempt at spec-compliant Range#max and Range#min from core
2019-07-09 01:40:44 -07:00
Yukihiro "Matz" Matsumoto
9add4a66c0
Merge pull request #4561 from shuujii/fix-the-order-of-expected-and-actual-in-test-t-range.rb
...
Fix the order of "expected" and "actual" in `test/t/range.rb`
2019-07-09 16:41:32 +09:00
Ryan Lopopolo
4085709ae1
Specialize Enumerable#max and Enumerable#min for Range
...
This patch prevents a hang for pathalogical (large) Ranges when
computing max and min.
Range inherits its implementation of max and min from Enumerable.
Enumerable implements max and min by calling each. For Range objects,
this is unnecessary since we know the max and the min by the end and
begin attributes.
It is also very slow. This code hangs unnecessarily:
(0..2**32).max
# ... hang
(0..2**32).min
# ... hang
This patch overrides max and min after including enumerable to yield
based on the begin and end methods.
2019-07-08 22:36:24 -07:00
Ryan Lopopolo
469c6261c6
Add tests for String Ranges
...
Range#each depends on String#upto which is implemented in mruby-string-ext
which is why these tests live there.
2019-07-08 22:36:24 -07:00
Ryan Lopopolo
f7d59dfe23
Add tests for Range#max and Range#min
2019-07-08 22:36:24 -07:00
KOBAYASHI Shuji
c8a7d0ab95
Fix the order of "expected" and "actual" in test/t/range.rb
2019-07-09 13:13:13 +09:00
Yukihiro "Matz" Matsumoto
0484bf133b
Merge pull request #4559 from shuujii/add-macros-for-inline-symbol-for-readability
...
Add macros for inline symbol for readability
2019-07-09 09:25:54 +09:00
KOBAYASHI Shuji
0a79486380
Add macros for inline symbol for readability
2019-07-08 22:14:23 +09:00
Yukihiro "Matz" Matsumoto
fd4e37404b
Merge pull request #4557 from shuujii/fix-Numeric-step-to-infinity
...
Fix `Numeric#step` to infinity; ref. #4555
2019-07-08 18:50:28 +09:00
KOBAYASHI Shuji
32c2aa10c7
Fix Numeric#step to infinity; ref. #4555
2019-07-07 22:10:32 +09:00
Yukihiro "Matz" Matsumoto
519f396365
Merge pull request #4554 from shuujii/fix-missing--ifndef-MRB_ENABLE_ALL_SYMBOLS
...
Fix missing `#ifndef MRB_ENABLE_ALL_SYMBOLS`
2019-07-06 21:09:13 +09:00
KOBAYASHI Shuji
df1f1002d9
Fix missing #ifndef MRB_ENABLE_ALL_SYMBOLS
2019-07-06 19:55:37 +09:00
Yukihiro "Matz" Matsumoto
280a83f029
Merge pull request #4553 from shuujii/read-write-MRB_STR_ASCII-flag-only-when-MRB_UTF8_STRING-is-defined
...
Read/write `MRB_STR_ASCII` flag only when `MRB_UTF8_STRING` is defined
2019-07-06 07:30:06 +09:00
KOBAYASHI Shuji
f9bf2d9d8e
Read/write MRB_STR_ASCII flag only when MRB_UTF8_STRING is defined
2019-07-05 22:19:31 +09:00
Yukihiro "Matz" Matsumoto
8294ce9fd4
It was too early to check key for undef; ref #4534
2019-07-04 23:11:57 +09:00
Yukihiro "Matz" Matsumoto
991bdd4ed7
Rename MRB_STR_NO_UTF to 'MRB_STR_ASCII`; close #4550
...
In #4550 , @shuuji proposed the name name `MRB_STR_NO_MULTI_BYTE` for
more precise description. Although I agree that the name name is
correct, but the flag means the string does not contain multi byte UTF-8
characters, i.e. all characters fit in the range of ASCII.
2019-07-04 23:07:18 +09:00
Yukihiro "Matz" Matsumoto
f4f3ced955
Merge pull request #4551 from dearblue/fix-4549
...
Fix heap buffer overflow; ref #4549
2019-07-04 22:50:06 +09:00
dearblue
2bb30481b6
Fix heap buffer overflow; ref #4549
...
This patch is showed in #4549 .
2019-07-04 21:49:07 +09:00
Yukihiro "Matz" Matsumoto
93b3b83cc4
Merge pull request #4548 from shuujii/refine-document-to-mrb_get_args
...
Refine document to mrb_get_args()` [ci skip]
2019-07-04 01:49:00 +09:00
KOBAYASHI Shuji
d915261590
Refine document to mrb_get_args()` [ci skip]
2019-07-03 20:41:30 +09:00
Yukihiro "Matz" Matsumoto
8c29b5998f
Merge pull request #4546 from shuujii/fix-and-refine-error-message-in-mrb_obj_to_sym
...
Fix and refine error message in `mrb_obj_to_sym()`
2019-07-02 19:55:42 +09:00
KOBAYASHI Shuji
0d54dbb264
Fix and refine error message in mrb_obj_to_sym()
...
Before this patch:
$ bin/mruby -e '1.respond_to?(2)' #=> nil is not a symbol
After this patch (same as Ruby):
$ bin/mruby -e '1.respond_to?(2)' #=> 2 is not a symbol nor a string
2019-07-02 19:41:40 +09:00
Yukihiro "Matz" Matsumoto
38a10e8a98
Merge pull request #4545 from shuujii/remove-unused-C-header-file-from-src-etc.c
...
Remove unused C header file from `src/etc.c`
2019-07-02 00:20:37 +09:00