Commit Graph

13947 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 019a2ddff4 mruby-rational/rational.c: implement Rational#**; close #5724 2022-06-21 16:53:17 +09:00
Yukihiro "Matz" Matsumoto 04de280997 mruby-rational/rational.c: wrap prototype with mrb_float
When `MRB_NO_FLOAT` is defined, `mrb_float` is not defined.
2022-06-21 16:37:32 +09:00
Yukihiro "Matz" Matsumoto 6f78cd6c99 mruby-rational/rational.c: remove unused prototype [ci skip] 2022-06-21 14:01:38 +09:00
Yukihiro "Matz" Matsumoto 9a34bd9971 hash.rb: update Hash class documents [ci skip] 2022-06-20 12:19:54 +09:00
Yukihiro "Matz" Matsumoto d2a24a540c hash.c: implement typical part of merge in C. 2022-06-19 22:28:31 +09:00
Yukihiro "Matz" Matsumoto 909e1044ed mruby-hash-ext/hash.rb (merge!): takes multiple arguments. 2022-06-18 16:12:14 +09:00
Yukihiro "Matz" Matsumoto 0565bbf85a test/hash.rb: test Hash#merge that takes multiple arguments. 2022-06-18 08:30:26 +09:00
Yukihiro "Matz" Matsumoto 14e5c0c7b9 hash.rb (merge): now takes multiple arguments. 2022-06-18 08:25:11 +09:00
Yukihiro "Matz" Matsumoto 7dec6e776e mruby-random/random.c: pointer to uint32_t cast may fail with clang. 2022-06-17 10:06:07 +09:00
Yukihiro "Matz" Matsumoto f1d669024a mruby-random/random.c: srand to use pointer address as a seed.
Utilize process randomiser which may not be provided by non Linux OSes.
With those OSes, rand() would return same values if the processes are
invoked within a second.
2022-06-17 07:14:29 +09:00
Yukihiro "Matz" Matsumoto 267c26d20b mruby-random/random.c: randomize Random::DEFAULT.
Using time(2) and randomized pointer address. May not work well with old
OSes without process randomiser.
2022-06-17 07:12:12 +09:00
Yukihiro "Matz" Matsumoto 0a63cdd594 mruby-random/random.c: use random: keyword argument.
For Array#sample and Array#shuffle. They used to take optional ordinal
argument for Random object but CRuby uses `random:` keyword argument.
Now mruby is compatible with CRuby here.
2022-06-16 11:17:22 +09:00
Yukihiro "Matz" Matsumoto 7005f8661b parse.y (paser_pfree): recycle memory if possible. 2022-06-15 07:28:05 +09:00
Yukihiro "Matz" Matsumoto 65ff04b20d Merge pull request #5722 from dearblue/gc_protect
Fixed possible inconsistency in `gc_protect()`
2022-06-15 07:27:36 +09:00
dearblue cbeb392d7d Fixed possible inconsistency in gc_protect()
If `mrb_realloc()` raises an out-of-memory exception, `arena_capa` will hold the wrong value.
2022-06-14 22:31:45 +09:00
Yukihiro "Matz" Matsumoto 561dffcccc parse.y: fix nested here-document bug; fix #5607
- remove `lex_strterm_before_heredoc` that does not nest
- remove `all_heredocs` that cannot distinguish nested and followed
  here-doc
- replace `lex_strterm` represented by cons list by C struct
- push/pop `lex_strterm` before/after interpolation
2022-06-13 22:25:37 +09:00
Yukihiro "Matz" Matsumoto 3cab2e7b78 mruby-compiler: remove spaces before * in type casting. 2022-06-13 17:00:30 +09:00
Yukihiro "Matz" Matsumoto 4d70d17af7 compile.h: reorder parser_heredoc_info members to reduce alignment gap. 2022-06-12 18:48:34 +09:00
Yukihiro "Matz" Matsumoto c41f24216b Merge pull request #5718 from dearblue/rehash-iv_mt
Asigns table properties after `mrb_calloc()`
2022-06-10 10:44:14 +09:00
dearblue 56c6dde9c5 Asigns table properties after mrb_calloc()
If GC occurs in `mrb_calloc()` called by `iv_rehash()` or `mt_rehash()`, the object as table data may be destroyed.
2022-06-08 22:10:58 +09:00
Yukihiro "Matz" Matsumoto b1f6c856e3 parse.y (nextc0): small refactoring. 2022-06-08 21:59:51 +09:00
Yukihiro "Matz" Matsumoto 0d2c550f0f parse.y: use info as abbreviation for information.
Replace `inf` that looks like abbreviation for `infinity`.
2022-06-07 18:42:53 +09:00
Yukihiro "Matz" Matsumoto 62fc021f5a .git-blame-ignore-revs: add 650ffb9 to ignore indentation fix. 2022-06-06 08:00:43 +09:00
Yukihiro "Matz" Matsumoto 9cc9c9fe63 parse.y (heredoc_treat_nextline): simplify the logic using append(). 2022-06-06 08:00:04 +09:00
Yukihiro "Matz" Matsumoto 4c92636684 AUTHORS: update entries [ci skip] 2022-06-06 08:00:04 +09:00
Yukihiro "Matz" Matsumoto 81fb3c5a4b parse.y: need to update p->lex_strterm in heredoc_treat_nextline(). 2022-06-06 08:00:03 +09:00
Yukihiro "Matz" Matsumoto 5233865c47 codegen.c (search_upvar): update messages for anonymous parameters. 2022-06-03 13:00:13 +09:00
Yukihiro "Matz" Matsumoto aec849888e parse.y (new_kw_rest_args): aggregate integer to node* type casts. 2022-06-03 13:00:12 +09:00
Yukihiro "Matz" Matsumoto e49ae398bd Rakefile: add install target; close #5712
This change is not complete. Contribution is welcome.

- need to update `mruby-config` to refer installed path
- may need to support installing shared library
- need to support cross-compiled binaries
2022-06-03 13:00:12 +09:00
Yukihiro "Matz" Matsumoto 5cbce646b0 parse.y: allow anonymous rest (and keyword rest) arguments. 2022-06-03 13:00:12 +09:00
Yukihiro "Matz" Matsumoto 6649b353c9 Merge pull request #5716 from dearblue/__method__check
Check `NULL` for `proc` and `env` in `Kernel#__method__`
2022-05-31 11:23:23 +09:00
Yukihiro "Matz" Matsumoto 0d828fa918 Merge pull request #5717 from mruby/dependabot/github_actions/github/super-linter-4.9.4
build(deps): bump github/super-linter from 4.9.3 to 4.9.4
2022-05-31 11:23:00 +09:00
dependabot[bot] 0f88b74f2b build(deps): bump github/super-linter from 4.9.3 to 4.9.4
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.3 to 4.9.4.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](https://github.com/github/super-linter/compare/v4.9.3...v4.9.4)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-30 14:07:39 +00:00
Yukihiro "Matz" Matsumoto 8981b2fb28 vm.c (ary_new_from_regs): stack may be reallocated.
Unlike `hash_new_from_regs`, `ary_new_from_regs` do not call
`mrb_funcall` et al directly or indirectly. But since it may invoke the
garbage collection, and hooks for GC may call `mrb_funcall` etc (although
calling them is not encouraged), we care stack reallocation just for the
safety.
2022-05-30 11:52:12 +09:00
Yukihiro "Matz" Matsumoto aa7f98dedb vm.c (hash_new_from_regs): stack may be reallocated. 2022-05-30 01:18:15 +09:00
Yukihiro "Matz" Matsumoto af5acf3566 parse.y: fix wrong indent [ci skip]. 2022-05-30 01:16:47 +09:00
Yukihiro "Matz" Matsumoto d55a152b3d mruby-string-ext/string.c (utf8code): max length of UTF-8 is 4 bytes.
It used to be 6 bytes in RFC2279 but overridden by new RFC3629.
2022-05-29 22:19:00 +09:00
Yukihiro "Matz" Matsumoto 82b87be4df string.c (mrb_utf8len): retry 7cdef2b0.
C++ requires `extern` declaration before variable definition.
2022-05-29 22:18:59 +09:00
Yukihiro "Matz" Matsumoto 0a8bfd1f8b Merge pull request #5713 from dearblue/assert-object-size
Introduced `mrb_static_assert_object_size()`
2022-05-29 22:18:48 +09:00
dearblue 444fbd76c2 Check NULL for proc and env in Kernel#__method__
Fix #5714
2022-05-29 11:28:54 +09:00
dearblue 23611332d9 Introduced mrb_static_assert_object_size()
Asserts the size of the object structure is less than or equal to 6 words.
2022-05-28 11:08:27 +09:00
Yukihiro "Matz" Matsumoto 2e0d371ef1 Merge pull request #5711 from mruby/dependabot/github_actions/github/super-linter-4.9.3
build(deps): bump github/super-linter from 4.9.2 to 4.9.3
2022-05-26 08:03:30 +09:00
dependabot[bot] 0efe2e6514 build(deps): bump github/super-linter from 4.9.2 to 4.9.3
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.2 to 4.9.3.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](https://github.com/github/super-linter/compare/v4.9.2...v4.9.3)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 14:08:32 +00:00
Yukihiro "Matz" Matsumoto 82f0ba14a9 Revert "string.c: share UTF-8 length table with mruby-string-ext."
This reverts commit 7cdef2b03e.
This sharing does not with C++ compilers.
2022-05-25 16:07:52 +09:00
Yukihiro "Matz" Matsumoto 7cdef2b03e string.c: share UTF-8 length table with mruby-string-ext. 2022-05-25 11:25:43 +09:00
Yukihiro "Matz" Matsumoto be0b5f8cee mruby-string-ext/string.c: reduce UTF-8 table size. 2022-05-25 11:22:28 +09:00
Yukihiro "Matz" Matsumoto 2f4695b759 mruby-string-ext/string.c: check sequence length before decoding. 2022-05-25 11:20:29 +09:00
Yukihiro "Matz" Matsumoto f08e66e53e mruby-string-ext/string.c (mrb_str_ord): fail with invalid UTF-8. 2022-05-25 11:17:49 +09:00
Yukihiro "Matz" Matsumoto bb99d7b2ca string.c (mrb_utf8len): reduce UTF-8 table size. 2022-05-25 08:04:19 +09:00
Yukihiro "Matz" Matsumoto d7731a95ab string.c (mrb_str_rindex_m): avoid RSTRING_CHAR_LEN() if possible.
Since it scans the string. Use char_backtrack() instead for negative
offset (counting from the tail).
2022-05-24 08:47:07 +09:00