Skip to content

Commit

Permalink
Get line numbers from calls.
Browse files Browse the repository at this point in the history
Signed-off-by: Caroline Russell <[email protected]>
  • Loading branch information
cerrussell committed Feb 13, 2024
1 parent a0e015f commit 89c25c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion atom_tools/lib/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def process_calls(self, method_map: Dict) -> Dict[str, Any]:
mmap = self.filter_calls(res, resolved_methods)
else:
mmap = self.filter_calls([], resolved_methods)

method_map['full_names'][full_name]['resolved_methods'] = (
mmap.get('resolved_methods'))

Expand All @@ -282,8 +283,14 @@ def filter_calls(
i for i in queried_calls
if i.get('resolvedMethod', '') == method
]
line_nos = [
i.get('lineNumber')
for i in calls
if i.get('lineNumber') and
i.get('resolvedMethod', '') == method
]
resolved_methods['resolved_methods'][method].update(
{'calls': calls})
{'calls': calls, 'line_nos': line_nos})
return resolved_methods

def methods_to_endpoints(
Expand Down Expand Up @@ -405,6 +412,7 @@ def create_paths_item(self, paths_dict: Dict) -> Dict:
"""
endpoints = paths_dict[1].get('endpoints')
calls = paths_dict[1].get('calls')
line_numbers = paths_dict[1].get('line_nos')
paths_object: Dict = {}

for ep in endpoints:
Expand All @@ -424,6 +432,8 @@ def create_paths_item(self, paths_dict: Dict) -> Dict:
paths_item_object |= self.calls_to_params(ep, call)
else:
paths_item_object |= self.calls_to_params(ep, None)
if line_numbers:
paths_item_object['x-atom-usages-line-no'] = line_numbers
if paths_item_object:
if paths_object.get(ep):
paths_object[ep] |= paths_item_object
Expand Down

0 comments on commit 89c25c8

Please sign in to comment.