[ruby-core:124465] [Ruby Feature#6012] Proc#source_location also return the column
Issue #6012 has been updated by Eregon (Benoit Daloze). mame (Yusuke Endoh) wrote in #note-50:
Also, Ruby's grammar will certainly continue to change, and I have no doubt that the instances of overlapping Nodes, beyond just `StatementsNode` and `CallNode`, can increase accordingly.
Maybe, but this does not matter for this feature. A {Method,UnboundMethod,Proc}#source_location will remain the same regardless of the number of overlapping Nodes. There are many use cases and ultimate purposes that are treating the source of a method/block as a string to e.g. print the source of the method/block, or inject extra code in it. I believe those are valid, even if they don't work in some weird edge case (heredoc across end). Requiring e.g. parsing + unparsing for every code transformation/instrumentation is too heavy, many use cases don't need that. ---------------------------------------- Feature #6012: Proc#source_location also return the column https://bugs.ruby-lang.org/issues/6012#change-116016 * Author: rogerdpack (Roger Pack) * Status: Closed * Assignee: nobu (Nobuyoshi Nakada) ---------------------------------------- As originally suggested in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/42418 Suggestion/feature request: have #source_location also return the beginning column where it was defined. ["test.rb", 8, 33] Thanks! -roger- -- https://bugs.ruby-lang.org/
participants (1)
-
Eregon (Benoit Daloze)