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


This is basically the same issue as #15634.  The default argument evaluation is not considered a separate expression, so no line event is generated.  If you force it to use a separate expression by wrapping in parentheses, you can get a line event, as @mame demonstrated.

Note that when not using a separate expression, the `coverage` shows a nil for the line.  If you force a separate expression and line, the `coverage` library can tell if the line was covered or not.

----------------------------------------
Bug #14889: TracePoint for :line never seems to trigger on argument list. Maybe by design?
https://bugs.ruby-lang.org/issues/14889#change-92596

* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I have the following code.

```
  30  1|		def print_summary(
  31  0|			output = $stdout
  32   |		)
```

In the margin is the line number followed by the number of hits according to `:line` trace point.

I feel like line 31 should also trigger a line trace point. It's an argument, but it must be executed.

Maybe a different trace point? `:argument`?



-- 
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>