Yukihiro "Matz" Matsumoto
c3cc559dfc
allocf.c: rename mrb_default_alloc to mrb_basic_alloc_func
...
Along with removing mrb_state first argument from the function. From
mruby 3.2, this function is *not* the default function, but the entry
point that can be redefined for the application. The function in
`src/allocf.c` is the default *implementation* (using malloc / realloc /
free) of the function.
2025-05-09 21:50:18 +09:00
Yukihiro "Matz" Matsumoto
0bdd529430
mruby.h: remove allocf and allocf_ud from mrb_state
...
This is preparation for memory allocation restructuring.
2025-05-09 18:13:28 +09:00
Yukihiro "Matz" Matsumoto
3d2f848e64
mruby-random: Random#rand(nil) should raise TypeError
2025-05-08 17:37:05 +09:00
Yukihiro "Matz" Matsumoto
88e86ee62e
mruby-random: update error messages to be compatible with CRuby; #6523
2025-05-08 16:42:33 +09:00
Yukihiro "Matz" Matsumoto
21d6bfb6dd
test/kernel.rb: disable some Kernel#p tests; ref #6524
2025-05-08 16:21:01 +09:00
Yukihiro "Matz" Matsumoto
37b84f40e0
Merge pull request #6523 from leviongit/rand-range
2025-05-08 16:06:02 +09:00
Yukihiro "Matz" Matsumoto
5b10fdf684
Merge pull request #6524 from hasumikin/fix/Kernel#p
2025-05-08 16:01:35 +09:00
Yukihiro "Matz" Matsumoto
147af9d669
Merge pull request #6522 from jbampton/label-more-files
2025-05-08 15:59:47 +09:00
Yukihiro "Matz" Matsumoto
3879b95a62
class.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512
2025-05-08 12:02:32 +09:00
Yukihiro "Matz" Matsumoto
2b0d866da1
class.c (find_visibility_scope): rename the function; ref #6512
...
Since the function returns either callinfo or env, thus the name does
not describe the current behavior. In addition, we did some refactoring
on the function.
2025-05-08 12:02:00 +09:00
Yukihiro "Matz" Matsumoto
50c8e180d8
class.c (find_visibility_ci): refactor to reduce complexity; ref #6512
2025-05-08 07:57:35 +09:00
Yukihiro "Matz" Matsumoto
dbc4768758
mruby/internal.h: rename visibility separation macros; ref #6512
2025-05-08 07:32:36 +09:00
Yukihiro "Matz" Matsumoto
c9a36e5d39
mruby/value.h: rename flag check macros; ref #6512
2025-05-08 07:27:30 +09:00
Yukihiro "Matz" Matsumoto
41e91a2ca8
vm.c (mrb_exec_irep): remove recently added separate_module argument
...
The argument was added in #6512
2025-05-08 07:27:23 +09:00
Yukihiro "Matz" Matsumoto
ef0cbc2981
mruby-eval (exec_irep): cache mrb->c->ci to a local variable
2025-05-07 23:30:41 +09:00
Yukihiro "Matz" Matsumoto
567617ceb5
Merge branch 'dearblue-visibility'
2025-05-07 15:37:37 +09:00
Yukihiro "Matz" Matsumoto
aec8d0c58b
Merge branch 'visibility' of github.com:dearblue/mruby into dearblue-visibility
2025-05-07 15:37:08 +09:00
Yukihiro "Matz" Matsumoto
81f5f5b8d4
mruby-bin-debugger: should not use Exception#inspect to print errors
...
Use mrb_exc_get_output() instead.
2025-05-07 12:34:13 +09:00
Yukihiro "Matz" Matsumoto
c36d9b7732
mruby-bin-mirb: should not use Exception#inspect to print errors
...
Use mrb_exc_get_output() instead.
2025-05-07 12:32:12 +09:00
Yukihiro "Matz" Matsumoto
6eb969ff04
backtrace.c (print_backtrace): use mrb_exc_get_output()
...
To keep the old error print even after Exception#inspect format changed.
2025-05-07 12:22:11 +09:00
Yukihiro "Matz" Matsumoto
33d9ad6c44
error.c (mrb_exc_get_output): a new function for old inspect format
2025-05-07 12:19:05 +09:00
Yukihiro "Matz" Matsumoto
85d048c1fb
mruby-error: update tests for new Exception#inspect format
2025-05-07 12:19:05 +09:00
Yukihiro "Matz" Matsumoto
a87b4b6bc3
test/exception.rb: update for new Exception#inspect
2025-05-07 12:19:05 +09:00
Yukihiro "Matz" Matsumoto
333c364d5f
error.c (mrb_exc_inspect): Update format to match CRuby
2025-05-07 12:19:04 +09:00
Yukihiro "Matz" Matsumoto
b5ad35d8ef
proc.h (MRB_SET_VISIBILITY_FLAGS): rename macro
2025-05-07 12:19:04 +09:00
Yukihiro "Matz" Matsumoto
0da5e0e190
AUTHORS: update entries [ci skip]
2025-05-07 12:19:04 +09:00
Yukihiro "Matz" Matsumoto
abfef2c38d
Merge pull request #6520 from jbampton/update-pre-commit
2025-05-04 23:19:54 +09:00
leviongit
7be940942c
random.c : treat ranges where r.begin > r.end the same way cruby does
2025-05-04 04:10:39 +02:00
leviongit
98906d5ac9
random.c : fix Random#rand not returning value
2025-05-04 03:48:22 +02:00
HASUMI Hitoshi
fdfd67ff40
Fix Kernel#p when no argument
...
## Expected
```ruby
p
=> nil
```
## Actual
```ruby
p
=> []
```
2025-05-04 10:17:37 +09:00
leviongit
202c213fe1
random.c : add some tests
2025-05-04 02:44:19 +02:00
leviongit
4390aeb78d
random.c : add rand(Range)
2025-05-04 02:44:19 +02:00
Yukihiro "Matz" Matsumoto
0723e10dcd
Merge pull request #6519 from jbampton/update-prettier-ignore
2025-05-03 14:42:24 +09:00
John Bampton
757c0472d0
gha: label more files
2025-05-03 04:47:04 +10:00
John Bampton
ddae958405
pre-commit: autoupdate and update node LTS version
...
https://nodejs.org/en
https://pre-commit.com/#pre-commit-autoupdate
2025-05-03 02:00:44 +10:00
John Bampton
7a3eebc1d5
Add tools/lrama to .prettierignore
...
Prettier uses an ignore file to exclude files from formatting when
running with pre-commit and also when running standalone from the command line.
This is detailed on the CLI docs page:
https://prettier.io/docs/cli
2025-05-03 01:42:36 +10:00
Yukihiro "Matz" Matsumoto
30d1db4528
10error.rb: move 2 more classes to error.c
...
- FloatDomainError
- RegexpError
2025-05-02 08:50:20 +09:00
Yukihiro "Matz" Matsumoto
0fb280adbf
10error.rb: move some error class definitions to error.c
...
- Exception
- ArgumentError
- LocalJumpError
- RangeErrpr
- TypeError
- IndexError
- KeyError
- NotImplementError
- FrozenError
- ZeroDivisionError
2025-05-01 15:10:55 +09:00
Yukihiro "Matz" Matsumoto
1bc16676a1
class.c: implement BasicObject#!= in C file
...
The method is defined in inline bytecode. As a side-effect, `00class.rb`
was removed.
2025-05-01 10:23:03 +09:00
Yukihiro "Matz" Matsumoto
683ecc09b5
codedump.c: do not print extra ';' if operands are not local vars
2025-04-30 07:54:40 +09:00
Yukihiro "Matz" Matsumoto
789d350da9
codedump.c: put parenthesis around virtual operand
...
Some operands are virtual (e.g. `a` and `a+1`). It is easier to count
instructions if you can distinguish virtual and real operands.
2025-04-29 07:49:59 +09:00
Yukihiro "Matz" Matsumoto
08f74dd2be
class.c: move alias attr attr_reader from 00class.rb
2025-04-28 14:20:07 +09:00
Yukihiro "Matz" Matsumoto
1b39c7d7da
mruby-compiler (codegen): private backquote should be called; fix #6516
2025-04-28 10:40:05 +09:00
Yukihiro "Matz" Matsumoto
e9d20a1590
doc/limitations.md: document double dispatch removal
...
We have removed `append_features`/`prepend_features`/`extend_object`.
It is incompatible with CRuby, but simpler.
2025-04-28 10:30:01 +09:00
Yukihiro "Matz" Matsumoto
6c72f8b378
class.c (extend_object): remove method; implement Kernel#extend in C
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto
6c25b5896a
class.c (prepend_features): remove the method
...
Just like `#append_features`, we remove `#prepend_features` and
implemented `#prepend` directly in C.
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto
9387cd382e
class.c (append_features): remove the method
...
The technique is called "double dispatch" (that was popular in
Smalltalk), but it does not work well with mruby. It's slower and
consumes more memory. Even thought `#append_features` defined in ISO
standard (15.2.2.4.11), we decided to remove it. Strictly speaking, it
is mruby limitation. And it should be documented clearly.
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto
5fe406d59c
vm.c (send_method): should not use C++ keyword public
2025-04-28 10:30:00 +09:00
Yukihiro "Matz" Matsumoto
a6ef3a45d1
vm.c (mrb_f_public_send): define #public_send method
...
The method itself is available when mruby-metaprog is loaded.
2025-04-25 17:39:12 +09:00
Yukihiro "Matz" Matsumoto
dd96afd5a8
variable.c (mrb_const_set): call const_added hook
2025-04-25 16:25:36 +09:00