leviongit
98906d5ac9
random.c : fix Random#rand not returning value
2025-05-04 03:48:22 +02: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
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
Yukihiro "Matz" Matsumoto
e5478c2b40
class.c (setup_class): simplified using mrb_const_set()
2025-04-25 16:23:02 +09:00
Yukihiro "Matz" Matsumoto
8f120971b5
variable.c: merge mrb_vm_const_set to mrb_const_set
...
Inline vm part to the VM itself.
2025-04-25 16:12:06 +09:00
Yukihiro "Matz" Matsumoto
03719490eb
class.c: define const_added method (with empty body)
2025-04-25 15:56:57 +09:00
Yukihiro "Matz" Matsumoto
6e1538ce3a
Merge pull request #6518 from HirohitoHigashi/master
2025-04-25 15:51:36 +09:00
Yukihiro "Matz" Matsumoto
279855985f
Merge pull request #6517 from jbampton/remove-unneeded-semicolon
2025-04-25 15:46:14 +09:00
HirohitoHigashi
586ff7a694
Change mrbc_args.flags bit width from 2 to 3.
2025-04-25 12:05:01 +09:00
John Bampton
fe201dc72f
core/codegen.c: remove unneeded duplicate semicolon
2025-04-25 05:10:24 +10:00
Yukihiro "Matz" Matsumoto
9c6349c769
Merge pull request #6513 from mruby/stable
2025-04-21 13:57:27 +09:00
Hiroshi Mimaki
d4097716b3
NEWS: remove wrong spelling from the pull-request description
2025-04-21 10:24:03 +09:00
mimaki
99f5668243
Merge branch 'master' into stable
2025-04-20 13:25:22 +09:00
mimaki
a309524d0b
Update version and release date. (mruby 3.4.0 (2025-04-20))
3.4.0
2025-04-20 13:08:22 +09:00
Yukihiro "Matz" Matsumoto
baea6e284e
mruby-bigint (mpz_bits): use lzb()
2025-04-17 08:11:27 +09:00
Yukihiro "Matz" Matsumoto
061521ead5
mruby-bigint (mpz_bits): renamed from mpz_bit_length()
2025-04-17 08:10:34 +09:00
Yukihiro "Matz" Matsumoto
16198dc985
mruby-numeric-ext (int_sqrt): translate Japanese comment (oops)
2025-04-17 01:43:03 +09:00
Yukihiro "Matz" Matsumoto
e42523fcf4
mruby-numeric-ext: add test for Integer.sqrt()
2025-04-16 23:30:23 +09:00
Yukihiro "Matz" Matsumoto
ddfe65763e
mruby-numeric-ext (int_sqrt): support bigint
2025-04-16 23:08:23 +09:00
Yukihiro "Matz" Matsumoto
dee661913f
mruby-numeric-ext (int_sqrt): Integer.sqrt implemented
...
This is the first version. It should support bigint eventually.
2025-04-16 22:37:06 +09:00
Yukihiro "Matz" Matsumoto
9a0f96e617
pre-commit autoupdate
2025-04-16 22:34:27 +09:00
Yukihiro "Matz" Matsumoto
8b213c4fbf
string.c (sub_replace): check if found argument is within proper range
...
Since it is an internal method, we didn't check the argument range, but
if it's called directly, out-of-range argument could cause SEGV.
2025-04-15 07:11:09 +09:00
Yukihiro "Matz" Matsumoto
9cc6d39956
test/module.rb: add test for #6506
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto
1969100fb4
variable.c (mrb_vm_get_const): seek singleton class superclass; fix #6506
...
Also ensure we don't revive #2515 , #3003 , #3598
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto
953ebdf334
variable.c (mrb_vm_const_get): refactoring for singleton classes
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto
95f9de4877
mruby-metaprog (mrb_mod_s_constants): Module.constants implemented
...
The method returns the list of all constants accessible from the point
of call.
2025-04-14 22:09:35 +09:00
Yukihiro "Matz" Matsumoto
e08452585e
variable.c (mrb_mod_cv_get): c must not be NULL as an argument
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto
90d77e71f5
variable.c (mrb_mod_cv_set): small refactoring
...
The argument c should not be NULL.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto
118e13d85c
variable.c: a new function mrb_mod_const_at()
...
And mrb_mod_constants() use the new function now.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto
cda551ce25
mruby-metaprog (mrb_mod_s_constants): call Module#constants if possible
...
When the optional argument is given or the receiver is not `Module`.
2025-04-14 22:09:34 +09:00
Yukihiro "Matz" Matsumoto
82522a2e71
mruby-bigint (mrb_bint_to_s): add check for MRB_32BIT and MRB_INT64
2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto
29964b3ba7
mruby-io (mrb_file_size): add check for MRB_32BIT and MRB_INT64
2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto
0d5fecf833
variable.c (mrb_const_get): adjust local variable scope
2025-04-14 22:09:33 +09:00
Yukihiro "Matz" Matsumoto
52de3b7e10
Merge pull request #6511 from dearblue/precommit
...
Exclude the external project "lrama" from pre-commit
2025-04-08 23:44:31 +09:00