23 Commits

Author SHA1 Message Date
dearblue 3fd5e1c250 Fixed visibility at method definition
There was a problem with visibility state from proc that straddles a fiber or is independent.

Therefore, it has been changed to give priority to env objects, if any.
Also, added "separate module" flag to block traversal to a higher level env object.

Note that the "separate module" flag is now set when calling blocks with the `mrb_yield_with_class()` function.

fixed https://github.com/mruby/mruby/issues/6494
2025-04-11 21:36:26 +09:00
Yukihiro "Matz" Matsumoto 93e133548f mruby-eval: make #eval private 2025-03-07 17:17:44 +09:00
Yukihiro "Matz" Matsumoto 013365498d test/eval.c: add test for #5528 2021-08-12 11:57:56 +09:00
Yukihiro "Matz" Matsumoto 651c234f9c eval.c: implement class_eval with string; close #5478 2021-06-16 09:12:03 +09:00
dearblue 297c5ac598 Merge branch 'binding' of https://github.com/ksss/mruby into HEAD 2021-02-22 22:14:46 +09:00
dearblue f85906b679 Remove patch_irep() in mruby-eval
- It can now deal with operands in the range of `OP_EXT*`.
- It can now call the same method as the variable name without arguments.

  ```ruby
  def a
    "Safe!"
  end

  a = "Auto!"

  eval "a()" # call method `a`
  ```
2020-06-02 14:49:27 +09:00
KOBAYASHI Shuji 9c79c28604 Move Kernel#instance_eval to BasicObject 2019-05-18 21:17:47 +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 b09d2eb900 Kernel#instance_eval should define singleton methods; fix #4069 2018-07-23 18:26:24 +09:00
Ichito Nagata 1dbeda5c9c add test for eval 2018-06-06 15:35:41 +09:00
ksss e8988197f2 Try Binding class 2017-02-24 11:06:47 +09:00
ksss ada264a513 instance_eval env should remake Fix #3191 2016-08-08 12:41:19 +09:00
INOUE Yasuyuki 49bfaca6c7 Add regression test for #2933 2015-10-04 18:22:34 +09:00
Satoshi Odawara 2551d14ff1 fixed. closures scope in eval(string) 2014-09-29 16:41:51 +09:00
Satoshi Odawara 432e8e9ea9 fixed evaluation context of eval(string) and instance_eval(string) 2014-08-08 16:59:40 +09:00
take_cheeze dd34decdfc Implement string compiling instance_eval method. 2014-07-15 22:33:14 +09:00
take_cheeze c6ce43303d Add SyntaxError test and don't print compilation error to stderr in eval. 2014-07-12 20:36:44 +09:00
take_cheeze 3aeb4568ab Add ISO index to Kernel.eval and Kernel#eval. 2014-05-18 23:45:24 +09:00
Miura Hideki da8d07d5d4 Suport block in Kernel#eval 2014-05-15 20:28:26 +09:00
Miura Hideki f10331cfe6 Modify eval for access outer local variable 2014-05-14 21:42:39 +09:00
take_cheeze d2011ce01a Support file name and line argument in Kernel.eval .
Only a nil binding will be supported.
2014-04-25 21:59:52 +09:00
take_cheeze f700346b44 Add tests for mruby-eval. 2014-03-26 12:59:17 +09:00