Yukihiro "Matz" Matsumoto
17ecf14511
Revert "Minimize the changes in #5277 "
...
This reverts commit dc51d89ac2 .
2021-01-26 10:57:07 +09:00
Yukihiro "Matz" Matsumoto
dc51d89ac2
Minimize the changes in #5277
...
Instead of including `mruby/presym.h` everywhere, we provided the
fallback `mruby/presym.inc` under `include/mruby` directory, and specify
`-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`.
So even when someone drops `-I<build-dir>/include` in compiler options,
it just compiles without failure.
2021-01-22 18:38:53 +09:00
KOBAYASHI Shuji
90b53f4c29
Avoid including presym.inc in existing header files
...
Addressed an issue where existing programs linking `libmruby.a` could only
be built by adding `<build-dir>/include` to compiler's include path.
2021-01-11 09:21:07 +09:00
Yukihiro "Matz" Matsumoto
3d8350f920
Retrieve irep from proc after MRB_PROC_CFUNC_P check; ref #5140
2020-11-18 10:07:26 +09:00
dearblue
f0a64329b1
Prohibit array changes by "a"/"*" specifier of mrb_get_args()
...
The "a"/"*" specifier of the `mrb_get_args()` function will now return `const mrb_value *`.
This is because it is difficult for the caller to check if it is an array object and write-barrier if necessary.
And it requires calling `mrb_ary_modify()` on the unmodified array object, which is also difficult (this is similar to #5087 ).
2020-10-22 22:55:35 +09:00
Yukihiro "Matz" Matsumoto
424afa4446
Make Proc#parameters to support keyword arguments; fix #5066
...
TODO: Unlike CRuby, mruby's `Proc#parameters` does not distinguish
required keyword arguments and optional keyword arguments currently.
2020-10-12 16:21:42 +09:00
Yukihiro "Matz" Matsumoto
3d8a38bea4
You don't need to keep index in local variables info in irep.
2020-10-12 16:21:22 +09:00
Yukihiro "Matz" Matsumoto
5a3e014e49
Constify irep members.
...
- `pool`
- `syms`
- `reps`
2020-10-12 16:21:03 +09:00
Yukihiro "Matz" Matsumoto
4aba93c969
Rename C function mrb_proc_lambda.
2020-05-15 15:55:35 +09:00
KOBAYASHI Shuji
04baaab311
Fix argument specs to Kernel
2019-11-15 19:07:42 +09:00
Yukihiro "Matz" Matsumoto
a365f9a67d
Rename symbol-to-string functions; close #4684
...
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
2019-09-25 23:52:00 +09:00
dearblue
099a4f3969
Entrust "no block given" error to mrb_get_args()
...
Some error messages will be changed.
2019-09-16 20:29:58 +09:00
KOBAYASHI Shuji
3b9b326d3c
Remove redundant colon in Proc#inspect (mruby-proc-ext)
...
Before this patch:
$ bin/mruby -e 'p proc{}' #=> #<Proc:0x7fd5eb8206d0@-e::1>
After this patch:
$ bin/mruby -e 'p proc{}' #=> #<Proc:0x7fd5eb8206d0@-e:1>
2019-06-11 20:33:07 +09:00
Yukihiro "Matz" Matsumoto
2871d0cdc5
Avoid keeping pointers from mrb_sym2name_len(); fix #4342
...
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342 .
This changes small incompatible changes in function prototypes:
* `mrb_parser_get_filename`: return value changed to `mrb_sym`.
* `mrb_debug_get_filename`: add `mrb_state*` as a first argument.
* `mrb_debug_get_line`: ditto.
I believe above functions are almost internal, and no third-party
mrbgem use them.
2019-04-01 14:13:06 +09:00
dearblue
fc20d0186d
Add test for #<< and #>> for Proc and Method class
2019-01-03 18:16:26 +09:00
dearblue
9a9e12a129
Add proc composition feature (CRuby-2.6 compatible)
...
- Proc#<< and Proc#>>
- Method#<< and Method#>>
2019-01-03 18:16:26 +09:00
Tatsuhiko Kubo
d2fb4752e2
Add test for Proc#parameters
2018-12-21 12:59:38 +09:00
Tatsuhiko Kubo
cc71bd51f1
optimize Proc#parameters
2018-12-21 12:59:38 +09:00
Yukihiro "Matz" Matsumoto
05f377dee4
Use __send__ instead of send.
2018-09-01 11:02:59 +09:00
Yukihiro "Matz" Matsumoto
8c9e712784
Keyword argument implemented.
2018-07-30 22:58:01 +09:00
Yukihiro "Matz" Matsumoto
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +09:00
Yukihiro "Matz" Matsumoto
8f2c62407c
Add MRB_METHOD_TABLE_INLINE option.
...
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.
`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
2017-11-20 18:33:41 +09:00
Christopher Aue
35deaae776
Tested LocalJumpErrors caused by break in a proc
2017-08-30 12:25:55 +02:00
Yukihiro "Matz" Matsumoto
88cd807379
Avoid use of snprintf() when DISABLE_STDIO is set; fix #3632
...
ref #3492 #3515 #3517
2017-04-25 10:41:50 +09:00
ksss
7f983928b9
Reduce object allocation
2017-04-02 23:34:26 +09:00
ksss
be5c304b4c
Fix parameters when noname rest
2017-04-02 23:30:05 +09:00
Yukihiro "Matz" Matsumoto
cea6a16cf4
Fixed some compiler errors regarding PRId.
2017-03-19 23:42:49 +09:00
Yukihiro "Matz" Matsumoto
ef105b5ca4
Use MRB_PRId instead of "%d"; fix #3515
2017-03-19 20:43:25 +09:00
ksss
3cba13c249
Proc shouldn't have initialize method
...
Fix #3356
2016-12-21 15:17:05 +09:00
Francois Chagnon
1ec5994377
Fix calling .arity on Proc with undefined initialize
...
Reported by @bouk
2016-11-24 10:23:31 -05:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Jun Hiroe
4e4929bc72
Rename extended xxxx class or module to xxxx class or module extension
2015-06-28 11:18:52 +09:00
Jun Hiroe
c69d1201e1
Fix typo; Replace extensional with extended
2015-06-28 00:05:58 +09:00
cremno
69b4c1648a
Proc#curry should preserve lambdas
2015-06-22 16:35:54 +02:00
Yukihiro "Matz" Matsumoto
471c43ff96
move mrb_proc_new_cfunc_with_env() to the core
2014-09-02 13:03:32 +09:00
Yukihiro "Matz" Matsumoto
206f89e209
add MRB_API modifiers to mruby API functions
2014-08-04 00:47:08 +09:00
ksss
9cafc5e105
Implement Proc#parameters
2014-06-25 16:05:33 +09:00
take_cheeze
2c451dd1fc
Use assert_kind_of instead.
2014-05-24 23:18:03 +09:00
take_cheeze
d8d07a2345
Move Kernel.local_variables to core.
2014-05-19 22:05:02 +09:00
take_cheeze
0f742392b5
Add ISO index to Kernel.local_variables.
2014-05-18 23:34:56 +09:00
Yukihiro "Matz" Matsumoto
41b46ca1ed
register<nlocals may not have a local variable name (e.g. a block arg); fix #2258
2014-05-16 00:04:55 +09:00
Yukihiro "Matz" Matsumoto
27df1a84bc
Kernel.local_variables to list UPVAR as well
2014-05-14 17:38:27 +09:00
take_cheeze
5073d14e28
Remove lv_len and use nlocals - 1 instead.
...
Check that `lv`'s length is always `nlocals - 1`.
2014-04-29 22:06:59 +09:00
take_cheeze
7ea82fedd5
Implement Kernel.local_variables for testing dumped local variables information.
2014-04-29 20:47:50 +09:00
Takeshi Watanabe
6e0c48d758
Fix and add test to Proc#inspect .
2014-04-14 22:01:52 +09:00
take_cheeze
b38eb72d82
Add macro MRB_ENV_UNSHARE_STACK instead of assigning -1 directly.
2014-04-01 01:35:40 +09:00
take_cheeze
80534b6d14
Use MRB_ENV_STACK_LEN instead of accessing flags directly to get REnv's stack length.
2014-04-01 01:13:39 +09:00
take_cheeze
bf6b1dfe21
Add API to define cfunc Proc with userdata.
...
The APIs are defined in mruby-proc-ext so include it before using this API.
See mruby-proc-ext's test code for usage.
This should resolve #1794 .
2014-03-31 10:01:17 +09:00
take_cheeze
c73f8d4def
move summary of mrbgems in default gembox to its spec
2014-03-17 00:34:24 +09:00
Masaki Muranaka
270d25bf2d
Make type casts safer.
2014-03-08 15:53:59 +09:00