• dearblue's avatar
    Partially allow overriding of `String#[]` methods · 8c355ec7
    dearblue authored
    This is for the purpose of supporting `Regexp`.
    
    - configuration and build
    
      ```console
      % cat regexp_config.rb
      MRuby::Lockfile.disable
      MRuby::Build.new do
        toolchain "clang"
        enable_debug
        gem core: "mruby-bin-mruby"
        gem core: "mruby-print"
        gem mgem: "mruby-onig-regexp"
        #gem mgem: "mruby-regexp-pcre"
      end
    
      % rake MRUBY_CONFIG=regexp_config.rb
      ```
    
    - mruby HEAD (bec074e6)
    
      ```console
      % build/host/bin/mruby -e 'p "abcdefg"[/.(?=...$)/]'
      -e:1: can't convert OnigRegexp into Integer (TypeError)
      ```
    
    - with this patch
    
      ```console
      % build/host/bin/mruby -e 'p "abcdefg"[/.(?=...$)/]'
      "d"
      ```
    8c355ec7
vm.c 80.2 KB