A function referenced BY NAME — passed as a call argument, or listed as a value in a dispatch table — is an indirect dependency of ``scope_nid``. Emit it as a distinct INFERRED ``indirect_call`` (kept out of the precise ``calls`` relation) only when the name resolves to a rea
(ident, scope_nid: str, enclosing_locals, context: str)
| 4961 | }) |
| 4962 | |
| 4963 | def _emit_indirect_ref(ident, scope_nid: str, enclosing_locals, context: str) -> None: |
| 4964 | """A function referenced BY NAME — passed as a call argument, or listed as a |
| 4965 | value in a dispatch table — is an indirect dependency of ``scope_nid``. Emit |
| 4966 | it as a distinct INFERRED ``indirect_call`` (kept out of the precise ``calls`` |
| 4967 | relation) only when the name resolves to a real callable and is NOT shadowed |
| 4968 | by a parameter / local binding. A callback defined in another file is deferred |
| 4969 | to the cross-file resolver via an ``indirect`` raw_call carrying its context. |
| 4970 | Language-agnostic; shared by the call-argument and dispatch-table capture |
| 4971 | paths for Python and JS/TS (#1565, #1566). |
| 4972 | """ |
| 4973 | if ident is None or ident.type not in ("identifier", "shorthand_property_identifier"): |
| 4974 | return |
| 4975 | ident_name = _read_text(ident, source) |
| 4976 | # shadowing: a param / local binding names a local value, not the module fn |
| 4977 | if ident_name in enclosing_locals or ident_name in ("self", "cls"): |
| 4978 | return |
| 4979 | _emit_indirect_by_name(ident_name, ident, scope_nid, context) |
| 4980 | |
| 4981 | def _python_dispatch_value_idents(coll_node): |
| 4982 | """Yield the identifier value-nodes of a dict/list/set/tuple literal that are |
no test coverage detected