| Age | Commit message (Collapse) | Author |
|
The code generator no longer need to emit `OP_LOADSYM` after `OP_DEF`.
`doc/opcode.md` is also updated.
|
|
|
|
|
|
This reverts commit fd10c7231906ca48cb35892d2a86460004b62249.
I thought it was OK to restrict index value within 1 byte, but in some
cases index value could be 16 bits (2 bytes). I had several ideas to
address the issue, but reverting `fd10c72` is the easiest way. The
biggest reason is `mruby/c` still supports `OP_EXT[123]`, so that they
don't need any additional work.
|
|
It does not need to hold an anonymous proc for constant search.
Also, this change can be expected to cause an anonymous proc to be GC'd.
This is useful for metaprogramming that makes heavy use of the `class`/`module`/`def` syntax in the `class_eval`/`eval` method.
Example:
- code
```ruby
p ObjectSpace.count_objects
String.class_eval do
def a
end
end
p ObjectSpace.count_objects
String.class_eval do
eval <<~CODE
def b
end
CODE
end
p ObjectSpace.count_objects
```
- result of building mruby-head (d63c0df6b) with `build_config/default.rb`
```
{:TOTAL=>1024, :FREE=>262, :T_PROC=>495, :T_ENV=>61, ...}
{:TOTAL=>1024, :FREE=>259, :T_PROC=>497, :T_ENV=>62, ...}
{:TOTAL=>1024, :FREE=>255, :T_PROC=>500, :T_ENV=>63, ...}
```
- result of building mruby with this patch and `build_config/default.rb`
```
{:TOTAL=>1024, :FREE=>264, :T_PROC=>494, :T_ENV=>60, ...}
{:TOTAL=>1024, :FREE=>262, :T_PROC=>495, :T_ENV=>61, ...}
{:TOTAL=>1024, :FREE=>261, :T_PROC=>496, :T_ENV=>61, ...}
```
|
|
Previously the following code did not produce the expected results:
```ruby
bx = binding
block = bx.eval("a = 1; proc { a }")
bx.eval("a = 2")
p block.call # Expect 2 but return 1 due to a bug
```
The previous implementation of `Binding#eval` evaluated the code and then merged the top layer variables.
This patch will parse and expand the variable space before making a call to `eval`.
This means that the call to `Binding#eval` will do the parsing twice.
In addition, the following changes will be made:
- Make `mrb_parser_foreach_top_variable()`, `mrb_binding_extract_proc()` and `mrb_binding_extract_env()` functions private global functions.
- Remove the `posthook` argument from `mrb_exec_irep()`.
The `posthook` argument was introduced to implement the `binding` method.
This patch is unnecessary because it uses a different implementation method.
ref #5362
fixed #5491
|
|
|
|
- `Module#method_added`
- `BasicObject#singleton_method_added`
|
|
- `truncate`
- `floor`
- `ceil`
`round` already takes `ndigits`.
|
|
|
|
The `MRB_OBJ_ALLOC()` macro function returns a pointer of the type corresponding to the constant literal defined in `enum mrb_vtype`.
|
|
- ` mrb_block_given_p()` -- The name comes from CRuby's `rb_block_given_p ()`
At the same time, it applies to `f_instance_eval()` and `f_class_eval()` of `mruby-eval`.
|
|
`mrb_vm_const_get` function looks up the constant first in the base
class, so that fallback `const_get` need not to search from the base.
|
|
|
|
```ruby
module M
FOO = 'm'
end
class A
FOO = 'a'
prepend M
end
class B < A
def foo
p FOO
end
end
B.new.foo # should print `m` not `a`
```
|
|
|
|
This reverts commit ee3017496ba60ca418b5e54c1f8f5d8b38524a52.
I misunderstood something and the new behavior was different from CRuby.
The issue was reported by @dearblue, regarding #5478
|
|
Run pre-commit with GitHub Actions
|
|
Running pre-commit with GitHub Actions now gives us more tests and coverage
Remove duplicate GitHub Actions for merge conflicts and trailing whitespace
Remove duplicate checks for markdownlint and yamllint from the GitHub Super-Linter
Add new custom pre-commit hook running with a shell script to sort alphabetically and uniquify codespell.txt
Add new pre-commit hook to check spelling with codespell
https://github.com/codespell-project/codespell
Fix spelling
|
|
`mrb_float_to_str()` used to take `fmt` argument. We thought no one used
the function, and OK to remove the argument. But at least `mruby-redis`
gem used the function.
|
|
|
|
Commit d0f60182af9114f6840d993d74f492e483302805 introduced an exception as a limitation of mruby.
Subsequent CRuby-2.7 has changed its behavior to raise an exception.
ref: https://github.com/ruby/ruby/commit/55b7ba368696033f2e89b77cbcd4a05dec97b139
|
|
Difference from `strtoul(3)`:
* reads `mrb_int` based on configuration
* specifies the end of the string
* no sign interpretation
* base 10 only
|
|
The file provides `mrb_read_float()` renamed from `vim_strtod()`.
|
|
|
|
* `mrb_cstr_to_inum()`
* `mrb_cstr_to_dbl()`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* refactor `mrb_integer_to_str()`
* refactor `mrb_str_format()`
|
|
|
|
So that `mruby -e 'a'` does not print backtrace history, i.e.
```
% mruby -e 'a'
-e:1: undefined method 'a' (NoMethodError)
```
Instead of
```
% mruby -e 'a'
trace (most recent call last):
[1] -e:1
-e:1: undefined method 'a' (NoMethodError)
```
|
|
Method names need not to be printed in backtrace history.
|
|
|
|
Use only `mrb_ary_entry` hereafter.
|
|
|
|
|
|
|
|
|
|
|
|
Instead of using copyrighted `strtod`, now use the public domain
implementation of `strtod` by Yasuhiro Matsumoto (@mattn). The function
has been renamed to `mrb_float_read()`; ref #5460 as well.
|
|
|
|
|
|
|
|
|
|
The function was intended to be a utility function for `mruby-sprintf`.
The functionality was integrated into `sprintf.c`.
|
|
The original code can be found in `https://github.com/dhylands/format-float`.
Changes:
- support `double`
- support `#` (alt_form) modifier
- small refactoring
|