[ruby-cvs:66220] ko1:r59043 (trunk): check break target correctly.

ko1 at ruby-lang.org ko1 at ruby-lang.org
Thu Jun 8 13:13:51 JST 2017


ko1	2017-06-08 13:13:51 +0900 (Thu, 08 Jun 2017)

  New Revision: 59043

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59043

  Log:
    check break target correctly.
    
    * compile.c (iseq_compile_each0): save target child_iseq in the catch-table
      for break. This iseq is not for continuation, but for search key at
      vm_throw_start().
    
    * vm_insnhelper.c (vm_throw_start): check saved iseq first.
    
    * iseq.h: add comment for it.
    
    * test/ruby/test_iterator.rb (test_ljump): add a test for the issue:
        def call b; b.call; end
        call(Proc.new{break}){} #=> (1) should raise LocalJumpError
        call(Proc.new{break})   #=> (2) shoudd raies LocalJumpError, too.
      but (1) doesn't raise LocalJumpError.
    
      This issue is reported by Matz.

  Modified files:
    trunk/compile.c
    trunk/iseq.h
    trunk/test/ruby/test_iterator.rb
    trunk/vm_insnhelper.c


More information about the ruby-cvs mailing list