20 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 49ae2a69f2 Add mrb_get_arg1() that retrieves single (and only) argument.
`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one
argument.

And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
2020-06-20 12:49:46 +09:00
Yukihiro "Matz" Matsumoto 6fe03f3b39 Add explicit cast to silence warnings on AppVeyor. 2020-06-04 11:01:30 +09:00
KOBAYASHI Shuji 97c62408fb Use mrb_str_concat instead of mrb_str_to_str + mrb_str_cat_str 2019-10-08 18:55:45 +09:00
KOBAYASHI Shuji feaf80d899 Use type predicate macros instead of mrb_type if possible
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
2019-09-26 22:23:27 +09:00
KOBAYASHI Shuji f252ab0770 Use mrb_define_method instead of mrb_define_alias 2019-09-21 16:51:10 +09:00
Yukihiro "Matz" Matsumoto 3daa53ce63 Implement bind_call method from Ruby2.7. 2019-09-16 10:10:09 +09:00
KOBAYASHI Shuji 334afb167c Use new specifiers/modifiers of mrb_vfromat()
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a) with this change.

  ------------+-------------------+-------------------+--------
   BINARY     | BEFORE (5116789a) |   AFTER (This PR) |  RATIO
  ------------+-------------------+-------------------+--------
   mruby      |      593416 bytes |      593208 bytes | -0.04%
   libmruby.a |      769048 bytes |      767264 bytes | -0.23%
  ------------+-------------------+-------------------+--------

BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613,
so I put it back.
2019-08-05 13:18:50 +09:00
Yukihiro "Matz" Matsumoto 6724416d5c Fixed a bug caused by to_s that returns nil; fix 4504 2019-06-25 18:07:48 +09:00
KOBAYASHI Shuji 270131253f Remove duplicated String#each_char 2019-04-27 12:50:02 +09:00
KOBAYASHI Shuji ed41bbb199 Use mrb_proc_arity instead of Proc#arity call in Method#arity 2019-04-04 22:17:26 +09:00
Yukihiro "Matz" Matsumoto d25b9c9d0e Remove unnecessary backticks; ref #4301 2019-02-28 12:59:16 +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
Yukihiro "Matz" Matsumoto b80e0ef742 Move Kernel#send to mruby-metaprog gem.
But `BasicObject#__send__` is still available from the core.
2018-09-01 11:20:30 +09:00
Yukihiro "Matz" Matsumoto e471d37ca5 Separate meta-programming features to mruby-metaprog gem.
We assume meta-programming is less used in embedded environments.
We have moved following methods:

 * Kernel module
   global_variables, local_variables, singleton_class,
   instance_variables, instance_variables_defined?, instance_variable_get,
   instance_variable_set, methods, private_methods, public_methods,
   protected_methods, singleton_methods, define_singleton_methods

 * Module class
   class_variables, class_variables_defined?, class_variable_get,
   class_variable_set, remove_class_variable, included_modules,
   instance_methods, remove_method, method_removed, constants

 * Module class methods
   constants, nesting

Note:
Following meta-programming methods are kept in the core:

 * Module class
   alias_method, undef_method, ancestors, const_defined?, const_get,
   const_set, remove_const, method_defined?, define_method

 * Toplevel object
   define_method

`mruby-metaprog` gem is linked by default (specified in default.gembox).
When it is removed, it will save 40KB (stripped:8KB) on x86-64
environment last time I measured.
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto 891839b976 New bytecode implementation of mruby VM. 2018-07-30 22:57:54 +09:00
ksss c0914dbb65 mruby/data.h doesn't need 2017-12-18 11:11:44 +09:00
ksss 615f296fcf Clean up some files and docs 2017-12-18 11:10:10 +09:00
ksss ae786b18d5 Shouldn't use alloca 2017-12-18 11:05:55 +09:00
ksss b83ff8ccd8 Add mrbgems/mruby-method
from https://github.com/ksss/mruby-method/commit/0837a0b507a5b4cdf8a1f1039ee371cee4e3b7fb
2017-12-18 10:54:37 +09:00