@@ -196,13 +196,13 @@ def resolve_node_id(id, node_attr):
196
196
id = node_attr [id ]["_skip_to" ].id
197
197
return id
198
198
199
- def get_context (id , node_attr , logger ):
199
+ def get_context (id , node_attr , path , logger ):
200
200
"""Gets the context of the node with the given `id`. This is either whatever is stored in the
201
201
`ctx` attribute of the node, or the result of dereferencing a sequence of `_inherited_ctx` attributes."""
202
202
203
203
while "ctx" not in node_attr [id ]:
204
204
if "_inherited_ctx" not in node_attr [id ]:
205
- logger .error ("No context for node {} with attributes {}\n " .format (id , node_attr [id ]))
205
+ logger .error ("No context for node {} in file {} with attributes {}\n " .format (id , path , node_attr [id ]))
206
206
# A missing context is most likely to be a "load", so return that.
207
207
return ast .Load ()
208
208
id = node_attr [id ]["_inherited_ctx" ].id
@@ -344,7 +344,7 @@ def parse(path, logger):
344
344
345
345
# Set up context information, if any
346
346
if "ctx" in expected_fields :
347
- node .ctx = get_context (id , node_attr , logger )
347
+ node .ctx = get_context (id , node_attr , path , logger )
348
348
# Set the fields.
349
349
for field , val in attrs .items ():
350
350
if field .startswith ("_" ): continue
0 commit comments