feat(code-intel): MQL (MQL4/5) + C++ call-graph code intelligence#2299
Draft
immy2good wants to merge 1 commit into
Draft
feat(code-intel): MQL (MQL4/5) + C++ call-graph code intelligence#2299immy2good wants to merge 1 commit into
immy2good wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an MQL-aware extraction layer (
.mq4/.mq5/.mqhparsed via thealready-shipped tree-sitter-cpp grammar under a distinct
mqllanguage tag) plusC++ 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
mqlover tree-sitter-cpp gives definitions, call edges, andcode_callers/code_callees/code_blast/code_flowfor a large, previouslyunsupported 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 andout-of-line (
C::method(){...}).Call edges with receiver-type resolution
m(),this->m()) → enclosing class (exactly-one-declaration rule)C::m(){...}) → class via the definition'squalified_identifierscopem_x.Method(),obj.Method()) → the receiver'sdeclared class type (cross-file; the dominant real-world shape)
bare — no confident false edges.
Short-name recall —
getCallersOf/getCalleesOfmatch a bare symbol against aqualified 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 walk —
code_blast/code_flowenabled 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.