From: TzeYang Ng <ngty77@...>
Date: 2011-11-11T14:17:30+09:00
Subject: [ruby-core:40936] [ruby-trunk - Bug #5614][Open] Proc#source_location & #inspect shows wrong line number when chained


Issue #5614 has been reported by TzeYang Ng.

----------------------------------------
Bug #5614: Proc#source_location & #inspect shows wrong line number when chained
http://redmine.ruby-lang.org/issues/5614

Author: TzeYang Ng
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 1.9.2
ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]


When procs are chained, the line number for each proc is mis-calculated to be the 1st proc's line-number.

Eg.

    class Foo
      def bar(&blk)
        pp blk.source_location
        self
      end
    end

    Foo.new.bar do
      puts 'b1'
    end.bar do
      puts 'b2'
    end

The 1st & 2nd procs show the same line number, when they shouldn't.

Though i listed the target version as 1.9.2, this behaviour is consistent for all versions of mri.



-- 
http://redmine.ruby-lang.org