Skip to content

feat: resolve JSX elements as call edges in the TypeScript/JavaScript plugin - #23

Merged
MCR-3 merged 1 commit into
mainfrom
19-jsx-call-edges
Sep 22, 2026
Merged

MCR-3 merged 1 commit into
mainfrom
19-jsx-call-edges

Conversation

@MCR-3

@MCR-3 MCR-3 commented Sep 22, 2026

Copy link
Copy Markdown
Member

Closes #19.

Mounting a function component (<Foo />, <Foo>...</Foo>, <Foo.Bar />) is now resolved as a Call edge, through the same identifier/member resolution _CallCollector already applies to call_expression - imports, local top-level functions, and the existing one-hop Foo.Bar limit. JSX desugars to a call, so it fits the existing Call edge concept rather than needing a new one.

  • A lowercase intrinsic element (<div />) is never a call - JSX's own capitalization convention distinguishes a component from a DOM element.
  • A fragment (<>...</>) has no tag name and is never a call.
  • A tag naming a class stays unresolved (out of scope, per the issue): a class has no single id in this plugin, only its methods do, so wiring <Foo /> to the constructor would mean something the runtime doesn't - the real call is render() via the reconciler.
  • Namespaced/computed tags beyond one hop (<Ns.Deep.Thing />) and hand-written React.createElement(...) stay unresolved, same as the equivalent non-JSX call shapes.

Extended sample_typescript_project/ with List.tsx: a function component that renders an imported component (resolves), a lowercase host element and a fragment (neither resolves), and the existing Item class as a tag (stays unresolved).

Verification

python -m backend.analyzer before/after on all three sample projects:

  • sample_project: 16 functions / 17 edges, byte-identical.
  • sample_rust_project: 8 functions / 6 edges, byte-identical.
  • sample_typescript_project: 16→18 functions, 16→17 edges - exactly the two new fixture functions and the one new List → Row edge; nothing else changed.

Also hand-tested the resolver against namespace-import tags, object-literal member tags, and the one-hop member-chain limit. backend.main still imports cleanly.

… plugin

Mounting a function component (<Foo />, <Foo>...</Foo>, <Foo.Bar />) is now
resolved as a call, through the same identifier/member resolution
_CallCollector already applies to call_expression - imports, local
top-level functions, and the existing one-hop Foo.Bar limit. JSX desugars
to a call, so this fits the existing Call edge concept.

A lowercase intrinsic element (<div />) and a fragment (<>...</>) are never
calls. A tag naming a class stays unresolved: a class has no single id in
this plugin, only its methods do, so wiring it to the constructor would
mean something the runtime doesn't (render() via the reconciler, not new).

Closes #19
@MCR-3
MCR-3 merged commit 5ac0a00 into main Sep 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve JSX elements as call edges in the TypeScript/JavaScript plugin

1 participant