Skip to content

Commit

Permalink
Provide fallback when mid_code_range method not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
riseshia authored and mame committed Apr 30, 2024
1 parent 581a225 commit d372cdd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/typeprof/core/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ def definitions(path, pos)
site.resolve(genv, nil) do |me, _ty, _mid, _orig_ty|
next unless me
me.defs.each do |mdef|
defs << [mdef.node.lenv.path, mdef.node.mid_code_range]
code_range =
case mdef.node
when AST::DefNode then mdef.node.mid_code_range
else mdef.node.code_range
end

defs << [mdef.node.lenv.path, code_range]
end
end
end
Expand Down

0 comments on commit d372cdd

Please sign in to comment.