From: Nobuyoshi Nakada Date: 2012-02-02T11:17:12+09:00 Subject: [ruby-core:42319] [ruby-trunk - Bug #5930] source_location of blocks incorrect Issue #5930 has been updated by Nobuyoshi Nakada. Yusuke Endoh wrote: > The following patch works for me, and passes test-all, > though I'm not sure if the fix is right. I'll commit > it if there is no objection. It seems right. Since brace_block already sets the correct line number, there should not be these fixpos()es. Please commit it. ---------------------------------------- Bug #5930: source_location of blocks incorrect https://bugs.ruby-lang.org/issues/5930 Author: Charlton Wang Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.2-p136 and newer Similar to bug #2427 but maybe the opposite problem. Newer versions of ruby appear to store the source locations of blocks incorrectly when passed as an argument to a multi-line invocation of a function. Snippet of code below reveals the problem: ----- def foo(*args, &block) p block.source_location end foo(1, 2, 3) do end ----- Under ruby 1.9.1-p243: ["-", 8] Under ruby 1.9.2-p136 and newer: ["-", 5] It seems with newer versions of ruby, it reports it based on the line on which the function is called instead of where the actual block is. I believe the old behaviour is actually the correct behaviour. Charlton -- http://bugs.ruby-lang.org/