Skip to content

feat(code-intel): MQL (MQL4/5) + C++ call-graph code intelligence#2299

Draft
immy2good wants to merge 1 commit into
garrytan:masterfrom
immy2good:feat/mql-cpp-code-intel
Draft

feat(code-intel): MQL (MQL4/5) + C++ call-graph code intelligence#2299
immy2good wants to merge 1 commit into
garrytan:masterfrom
immy2good:feat/mql-cpp-code-intel

Conversation

@immy2good

Copy link
Copy Markdown

What

Adds an MQL-aware extraction layer (.mq4 / .mq5 / .mqh parsed via the
already-shipped tree-sitter-cpp grammar under a distinct mql language tag) plus
C++ receiver-type resolution, producing a precise within-source call graph.

Why

MQL4/MQL5 (MetaTrader) is a C/C++ subset with no dedicated tree-sitter grammar.
Tagging it mql over tree-sitter-cpp gives definitions, call edges, and
code_callers/code_callees/code_blast/code_flow for a large, previously
unsupported language family — and the C++ receiver-resolution work it required is
general-purpose (benefits plain C++ too).

What's in it

Definitions — class methods as scoped chunks (Class.method), inline and
out-of-line (C::method(){...}).

Call edges with receiver-type resolution

  • implicit-self (m(), this->m()) → enclosing class (exactly-one-declaration rule)
  • out-of-line (C::m(){...}) → class via the definition's qualified_identifier scope
  • member-field / local-object (m_x.Method(), obj.Method()) → the receiver's
    declared class type (cross-file; the dominant real-world shape)
  • Honest precision boundary: genuine globals/library calls and overloads stay
    bare — no confident false edges.

Short-name recallgetCallersOf/getCalleesOf match a bare symbol against a
qualified edge's last segment, so receiver-resolved edges stay reachable by short
name (honors the documented "bare or qualified name" param). One shared predicate
keeps the pglite + postgres engines byte-identical (engine parity).

Recursive walkcode_blast/code_flow enabled for cpp + mql.

Testing

All TDD. New suites cover defs, every receiver shape, the precision boundary,
short-name recall, recursive walk, and source-scoped multi-source queries. Engine
parity preserved. Validated on a real multi-file MQL corpus: 165 qualified call
edges, 100% resolving to a real def, 0 false edges.

Marked draft pending a final review pass.

Adds an MQL-aware extraction layer (.mq4/.mq5/.mqh parsed via the shipped
tree-sitter-cpp grammar under a distinct `mql` language tag) plus C++
receiver-type resolution, surfacing a precise within-source call graph.

Definitions
- Class methods emitted as scoped chunks (Class.method), for inline AND
  out-of-line (`C::method(){...}`) definitions.

Call edges with receiver-type resolution
- implicit-self (`m()`, `this->m()`) → enclosing class (exactly-one-declaration
  rule).
- out-of-line (`C::m(){...}`) → class named by the definition's
  qualified_identifier scope.
- member-field / local-object (`m_x.Method()`, `obj.Method()`) → the receiver's
  declared class type (the dominant real-world shape; cross-file).
- Honest precision boundary: genuine globals/library calls and overloads stay
  bare — no confident false edges.

Short-name recall
- getCallersOf / getCalleesOf match a bare symbol against a qualified edge's
  last segment, so receiver-resolved edges stay reachable by short name. Honors
  the documented "bare or qualified name" param contract. Shared predicate keeps
  the pglite + postgres engines byte-identical (engine parity).

Recursive walk
- code_blast / code_flow enabled for cpp + mql (sink classification is a
  graceful no-op for them).

All TDD; engine parity preserved. Validated on a real multi-file MQL corpus:
165 qualified call edges, 100% resolving to a real def, 0 false; reaches a
multi-source brain via the source-scoped query path.
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.

1 participant