MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _scan_js_module_dispatch

Function _scan_js_module_dispatch

graphify/extract.py:5651–5668  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

5649 js_module_bound = _js_module_bound_names(root, source)
5650
5651 def _scan_js_module_dispatch(n) -> None:
5652 if n.type in _JS_SCOPE_BOUNDARY:
5653 return # function / class bodies are walked separately
5654 if n.type in ("object", "array"):
5655 for ident in _js_dispatch_value_idents(n):
5656 _emit_indirect_ref(ident, file_nid, js_module_bound, "collection")
5657 elif n.type in ("call_expression", "new_expression"):
5658 # Module-level callback registration is idiomatic in JS — Express
5659 # routes (`app.get("/", handler)`), event wiring (`emitter.on("e",
5660 # handler)`), `setTimeout(fn)`. Capture identifier args as indirect
5661 # refs of the file (inline arrows are direct defs, not by-name refs).
5662 margs = n.child_by_field_name("arguments")
5663 if margs is not None:
5664 for marg in margs.children:
5665 if marg.type == "identifier":
5666 _emit_indirect_ref(marg, file_nid, js_module_bound, "argument")
5667 for c in n.children:
5668 _scan_js_module_dispatch(c)
5669
5670 _scan_js_module_dispatch(root)
5671

Callers 1

_extract_genericFunction · 0.85

Calls 2

_emit_indirect_refFunction · 0.85

Tested by

no test coverage detected