Commit Graph

14270 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 78c8b649e7 mruby-print/print.c: small refactoring.
Inline `printstr` function which is called from only one place.
2022-10-05 23:11:11 +09:00
Yukihiro "Matz" Matsumoto 268f6dcab3 numeric.c (mrb_float_to_integer): isinf/isnan takes any float values.
So don't need to cast to `float`, just use `mrb_float`.
2022-10-04 11:05:15 +09:00
Yukihiro "Matz" Matsumoto 62e0e3eebe class.c (mrb_get_args_a): adjust spacing [ci skip] 2022-10-04 11:05:15 +09:00
Yukihiro "Matz" Matsumoto ea1bc39b52 mruby-proc-ext/proc.c (mrb_proc_inspect): update the format. 2022-10-04 11:05:15 +09:00
Yukihiro "Matz" Matsumoto e7e22ec6a8 mruby-method/method.c (method_to_s): add location information.
Test updated too.
2022-10-04 11:05:14 +09:00
Yukihiro "Matz" Matsumoto 0c9fd9cffd Merge pull request #5798 from boahc077/github_actions_token_permission
ci: add minimum GitHub token permissions for workflows
2022-10-04 11:05:07 +09:00
Ashish Kurmi 34c640b8be ci: add minimum GitHub token permissions for workflows
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
2022-10-02 10:15:55 -07:00
Yukihiro "Matz" Matsumoto 751ac378bd codegen.c: should not skip rhs array; fix #5797
When the value of multiple assignment taken, the rhs array needs to be
generated anyway.
2022-10-01 15:18:45 +09:00
Yukihiro "Matz" Matsumoto db7d40be85 mruby-proc-ext/proc.c (mrb_proc_parameters): disclose unnamed arguments.
Unnamed arguments (*, **, &) should be disclosed in the parameter list.
The test is also updated.
2022-09-30 22:19:59 +09:00
Yukihiro "Matz" Matsumoto 7ced009d4c mruby-proc-ext/proc.c (mrb_proc_parameters): unify conditions. 2022-09-30 22:19:58 +09:00
Yukihiro "Matz" Matsumoto 3d766aa1ef mruby-proc-ext/proc.c (mrb_proc_parameters): count arguments first.
Instead of approximating using `irep->nlocals-1` (which should be bigger
than argument numbers).
2022-09-30 22:19:36 +09:00
Yukihiro "Matz" Matsumoto 3a2de4af00 mruby-proc-ext/proc.c (mrb_proc_parameters): skip empty block slot.
Unlike other formal arguments, a block argument has an empty slot even
when the block is not given.
2022-09-30 07:49:44 +09:00
Yukihiro "Matz" Matsumoto 7667b0fc04 mruby-proc-ext/proc.c (mrb_proc_parameters): reformat. 2022-09-30 07:43:57 +09:00
Yukihiro "Matz" Matsumoto 3c16423c0a mruby-method/method.c (method_to_s): making it compatible with CRuby. 2022-09-29 11:00:49 +09:00
Yukihiro "Matz" Matsumoto b73802d437 vm.c (cipop): wrong callinfo shifts fixed; ref #5791 2022-09-28 16:57:11 +09:00
Yukihiro "Matz" Matsumoto 5e1c16653f mruby-method/method.c (method_super_method): fixed module related bug.
When the method is defined in module, super_method started method
searching from wrong point. We needed to find ICLASS corresponding to the
module, then start searching super_method from the next ancestor.
2022-09-27 23:03:38 +09:00
Yukihiro "Matz" Matsumoto 0a0ab73e8d mruby-class-ext: #subclasses should be a method of Class, not Module. 2022-09-27 23:03:23 +09:00
Yukihiro "Matz" Matsumoto 0c475708de vm.c (cipop): use mrb_object_dead_p() to detect reclaimed block; #5791 2022-09-26 07:50:41 +09:00
Yukihiro "Matz" Matsumoto 993c8c1053 gc.c (final_marking_phase): move exception clearing after marking; #5789 2022-09-24 23:08:28 +09:00
Yukihiro "Matz" Matsumoto d9061bd969 numeric.c: update documents [ci skip]. 2022-09-23 22:13:28 +09:00
Yukihiro "Matz" Matsumoto a04b09d535 Merge pull request #5796 from dearblue/bigint-readme
Small improves for `mrbgems/mruby-bigint/README.md` [ci skip]
2022-09-22 10:53:57 +09:00
dearblue b7069dba41 Small improves for mrbgems/mruby-bigint/README.md [ci skip]
- Add a period at the end of the line because markdown will combine lines if there are no blank lines.
- Enable link to `README-fgmp.md`.
2022-09-21 22:50:47 +09:00
Yukihiro "Matz" Matsumoto 07470eb538 mruby-exit.c: make exit() to raise SystemExit exception.
Now it allows error handlers to work, unlike `exit!`.
2022-09-21 22:37:23 +09:00
Yukihiro "Matz" Matsumoto 11504318b8 string-ext/string.rb: String#prepend to take multiple arguments. 2022-09-20 18:31:04 +09:00
Yukihiro "Matz" Matsumoto 4cba1b49c0 string-ext/string.c: String#concat to take multiple arguments. 2022-09-20 18:26:23 +09:00
Yukihiro "Matz" Matsumoto a4099ff776 enum-ext/enum.rb: add Enumerable#sum 2022-09-19 12:31:11 +09:00
Yukihiro "Matz" Matsumoto 81f98a3925 vm.c (cipop): check type of the callinfo::blk; fix #5791
Since `callinfo::blk` is not marked in the GC, it may be reclaimed in
the sweep phase. When it reclaimed, it will become either (a) a non Proc
object, or (b) a Proc object that happen to have the same address.

For case (a), adding `b->tt == MRB_TT_PROC` check works. We should avoid
the following `MRB_PROC_STRICT_P()` and `MRB_PROC_ENV()` operations for
non Proc objects.

For case (b), `MRB_PROC_ENV(b) == CI_ENV(&c->ci[-1])` check should work.
Unrelated Proc objects should be filtered by the check.

We don't need to clear `callinfo::blk` by `NULL` because the callinfo
struct will be discarded afterward in the `cipop()` function.
2022-09-19 08:35:36 +09:00
Yukihiro "Matz" Matsumoto 5b62fbc0fc array.c (mrb_ary_concat_m): Array#concat to take multiple arguments. 2022-09-19 08:25:00 +09:00
Yukihiro "Matz" Matsumoto 9caa4d642c errno.rb: fixed a typo. 2022-09-18 08:01:07 +09:00
Yukihiro "Matz" Matsumoto 3d125aeb89 errno.c (mrb_exxx_init): simplify the function.
Code duplication with mrb_sce_init has been unified.
2022-09-18 07:59:36 +09:00
Yukihiro "Matz" Matsumoto db536da412 errno.c (mrb_sce_sys_fail): SystemCallError may be overridden; fix #5793 2022-09-18 00:07:28 +09:00
Yukihiro "Matz" Matsumoto a5d7326eaa Merge pull request #5795 from jbampton/pre-commit-autoupdate
pre-commit autoupdate, fix spelling, update codespell.txt
2022-09-18 00:06:36 +09:00
John Bampton 2990aaa343 pre-commit autoupdate, fix spelling, update codespell.txt
https://pre-commit.com/#pre-commit-autoupdate
2022-09-18 00:22:55 +10:00
Yukihiro "Matz" Matsumoto 71d5cae016 Merge pull request #5792 from dearblue/stderr
Retrieve the `StandardError` class from `mrb_state`
2022-09-17 22:48:50 +09:00
Yukihiro "Matz" Matsumoto dd5a9f74d8 Merge pull request #5794 from jbampton/fix-makefile
Fix Makefile. Change `lint` to `check`
2022-09-17 22:45:38 +09:00
John Bampton d0ba1fb3ca Fix Makefile. Change lint to check 2022-09-17 23:23:35 +10:00
dearblue 50ea98e76d Retrieve the StandardError class from mrb_state 2022-09-17 22:03:52 +09:00
Yukihiro "Matz" Matsumoto a9d0e9a412 Makefile,Rakefile: rename lint target to check; #5790
The pre-commit check does some static analysis but the term lint is used
as static analysis of software code under the UNIX environment. So we
have renamed the target `check`.
2022-09-17 16:44:24 +09:00
Yukihiro "Matz" Matsumoto 52b2e12f07 numeric_ext.c: implement Integer#digits method.
Which is added in Ruby 2.4.
2022-09-17 16:43:06 +09:00
Yukihiro "Matz" Matsumoto bd1310c9f9 gc.c (incremental_gc_finish): rename the function.
incremental_gc_until() are always called with MRB_GC_STATE_ROOT.
So no need to supply it from outside.
2022-09-17 16:43:06 +09:00
Yukihiro "Matz" Matsumoto b774a004a0 Merge pull request #5790 from jbampton/add-lint-target-to-make
Add `lint` target to the Makefile
2022-09-17 16:41:16 +09:00
John Bampton b466271f16 Add lint target to the Makefile
Add `lint` task to the Rakefile

Runs `pre-commit run --all-files`
2022-09-16 13:26:25 +10:00
Yukihiro "Matz" Matsumoto 74b8bbd8b3 TODO.md: update [ci skip]
Remove bigint entry that we have implemented finally.
2022-09-15 06:43:11 +09:00
Yukihiro "Matz" Matsumoto 97a419f540 gc.c (clear_error_object): need to mark class of error objects; ref #5789 2022-09-13 22:20:34 +09:00
Yukihiro "Matz" Matsumoto b5677bff1f gc.c (final_marking_phase): clear error objects before sweep; close #5789
Some error objects are referenced from `mrb_state`, and previously they
are simply marked as root objects. But when they are not referenced from
other part of the program, they are no longer used at the current incarnation.
That means we can safely reclaim their child objects (their messages and
backtrace information).
2022-09-13 07:16:38 +09:00
Yukihiro "Matz" Matsumoto b716bf005e mruby-range-ext/range.c: use the reference from mrb structure.
Avoid `mrb_class_get()` if possible.
2022-09-12 10:29:45 +09:00
Yukihiro "Matz" Matsumoto d72d26afcb mruby-string-ext/string.c: use the reference from mrb structure. 2022-09-12 10:27:31 +09:00
Yukihiro "Matz" Matsumoto 3662d3d9da fixup! numeric_ext.c: use the reference from mrb structure. 2022-09-12 10:27:30 +09:00
Yukihiro "Matz" Matsumoto fc85523cf1 numeric_ext.c: use the reference from mrb structure. 2022-09-12 10:27:29 +09:00
Yukihiro "Matz" Matsumoto f05574606e mruby-numeric-ext: add ceildiv test with Float and Rational. 2022-09-12 10:27:29 +09:00