diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/forwardable.rb | 37 |
2 files changed, 29 insertions, 13 deletions
@@ -1,3 +1,8 @@ Fri Sep 23 12:15:29 2016 Nobuyoshi Nakada <[email protected]> * compile.c (iseq_peephole_optimize): enable tail call @@ -195,31 +195,42 @@ module Forwardable accessor = "#{accessor}()" end - unless begin - iseq = RubyVM::InstructionSequence - .compile("().#{method}", nil, nil, 0, false) - rescue SyntaxError - else - iseq.to_a.dig(-1, 1, 1, :mid) == method.to_sym - end - method_call = "__send__(:#{method}, *args, &block)" - else - method_call = "#{method}(*args, &block)" end line_no = __LINE__+1; str = "#{<<-"begin;"}\n#{<<-"end;"}" begin; proc do def #{ali}(*args, &block) begin #{accessor} - end.#{method_call} end end end; - RubyVM::InstructionSequence - .compile(str, __FILE__, __FILE__, line_no, trace_instruction: false, tailcall_optimization: true) .eval |