Commit 1b8d4a3
committed
Constants defined in C extensions might be attributed other the gems
Some constants like `ERB::Escape` that are defind in C extension
components of gems are currently failing the `defined_in_gem?` look up.
This happens for `ERB::Escape` because, instead of
`erb/lib/erb/utils.rb` loading the shared-object for `escape`, we have
`erubi` loading it. Thus, when we do the backtrace scan to find the file
that is loading the constant we attribute it to the `erubi` gem. This is
because there are no frames in the backtrace for the class definition
coming from a C extension, thus we miss the actual file that does the
`ERB::Escape` definition.
Since we can look up the source location of constants now, it makes more
sense to include that in the list of file candidate locations. Which
makes it resilient against these kinds of mistakes.1 parent 22141ae commit 1b8d4a3
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
| |||
0 commit comments