Issue #15634 has been updated by jeremyevans0 (Jeremy Evans).


The reason there is no event emitted for Line 17 in the example (#note-1) is there is no new expression/statement on that line.  It is a continuation of the previous expression.  I think we should adjust the documentation for the :line event to reflect the current behavior, and submitted a pull request for that: https://github.com/ruby/ruby/pull/4589.

The alternative would be emitting line events at many more places than we do now.  For example, do we want 1, 3, or 5 line events for this:

```ruby
[
  1,
  2,
  3
]
```

I think trying to increase the number of line events would require a lot of work for very little practical gain. In other words, the cost of doing so is much higher than the benefits.

----------------------------------------
Bug #15634: TracePoint seems to be skipping some methods.
https://bugs.ruby-lang.org/issues/15634#change-92591

* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.1
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
```ruby
trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
    puts [trace.path, trace.lineno].join(":")
end

trace_point.enable

values = {foo: 10}

def shell_escape(x)
    x
end

values.map{|key, value| [
    key.to_s.upcase,
    shell_escape(value) # TracePoint is never triggered for this line.
]}
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>