1. 29 Jun, 2021 1 commit
  2. 28 Jun, 2021 2 commits
    • dearblue's avatar
      Avoid warnings with `ruby -cw` · 2d0b50f6
      dearblue authored
      ```console
      % for rb in `git ls-files '*/mrblib/*.rb' 'mrblib'`; do ruby30 -cw $rb > /dev/null; done
      mrbgems/mruby-array-ext/mrblib/array.rb:389: warning: assigned but unused variable - ary
      mrbgems/mruby-array-ext/mrblib/array.rb:663: warning: assigned but unused variable - len
      mrbgems/mruby-hash-ext/mrblib/hash.rb:119: warning: possibly useless use of a variable in void context
      mrbgems/mruby-hash-ext/mrblib/hash.rb:259: warning: assigned but unused variable - keys
      mrbgems/mruby-io/mrblib/io.rb:229: warning: literal in condition
      mrbgems/mruby-io/mrblib/io.rb:280: warning: literal in condition
      mrbgems/mruby-string-ext/mrblib/string.rb:347: warning: assigned but unused variable - len
      mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
      ```
      2d0b50f6
    • Yukihiro "Matz" Matsumoto's avatar
      Merge pull request #5493 from dearblue/binding.2 · d63c0df6
      Yukihiro "Matz" Matsumoto authored
      Fixed finding variables from `proc` in `binding.eval` failed
      d63c0df6
  3. 27 Jun, 2021 1 commit
  4. 26 Jun, 2021 4 commits
    • dearblue's avatar
      Fixed finding variables from `proc` in `binding.eval` failed · c182903e
      dearblue authored
      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
      c182903e
    • Yukihiro "Matz" Matsumoto's avatar
      Merge pull request #5494 from dearblue/eval.1 · 912b2f8d
      Yukihiro "Matz" Matsumoto authored
      Fix memory leak in `Kernel#eval`
      912b2f8d
    • dearblue's avatar
      Fixed finding variables defined in the upper proc failed · 52b29f41
      dearblue authored
      If no new variable was defined in the `eval` method, the variable was hidden from the nested `eval` method.
      
      ```ruby
      a = 1
      p eval %(b = 2; eval %(a)) # => 1 (good)
      p eval %(eval %(a)) # => undefined method 'a' (NoMethodError)
      ```
      
      This issue has occurred since mruby 3.0.0.
      52b29f41
    • dearblue's avatar
      Fix memory leak in `Kernel#eval` · cf38fc2f
      dearblue authored
      The `mrbc_context` remained unreleased when the `mrb_parse_nstring()` function returned `NULL`.
      cf38fc2f
  5. 25 Jun, 2021 1 commit
  6. 24 Jun, 2021 2 commits
  7. 23 Jun, 2021 2 commits
  8. 22 Jun, 2021 4 commits
  9. 21 Jun, 2021 3 commits
  10. 20 Jun, 2021 2 commits
  11. 19 Jun, 2021 4 commits
  12. 18 Jun, 2021 2 commits
  13. 17 Jun, 2021 12 commits