gitnexus 1.6.5-rc.8 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared/scope-resolution/finalize-algorithm.js +10 -2
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +26 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/method-dispatch-index.js +22 -3
- package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/lookup-core.js +18 -1
- package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -1
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +2 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +1 -0
- package/dist/cli/ai-context.js +70 -16
- package/dist/cli/analyze.d.ts +30 -2
- package/dist/cli/analyze.js +45 -5
- package/dist/cli/index.js +8 -1
- package/dist/cli/setup.js +18 -0
- package/dist/cli/wiki.d.ts +2 -0
- package/dist/cli/wiki.js +11 -0
- package/dist/core/augmentation/engine.js +24 -4
- package/dist/core/embeddings/http-client.js +22 -6
- package/dist/core/incremental/shadow-candidates.d.ts +44 -0
- package/dist/core/incremental/shadow-candidates.js +74 -0
- package/dist/core/incremental/subgraph-extract.d.ts +64 -0
- package/dist/core/incremental/subgraph-extract.js +111 -0
- package/dist/core/ingestion/call-processor.d.ts +12 -1
- package/dist/core/ingestion/call-processor.js +183 -47
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +38 -0
- package/dist/core/ingestion/class-extractors/generic.js +8 -0
- package/dist/core/ingestion/class-types.d.ts +15 -0
- package/dist/core/ingestion/community-processor.js +18 -0
- package/dist/core/ingestion/import-resolvers/standard.d.ts +5 -0
- package/dist/core/ingestion/import-resolvers/standard.js +31 -1
- package/dist/core/ingestion/import-resolvers/utils.js +4 -0
- package/dist/core/ingestion/languages/c-cpp.js +20 -2
- package/dist/core/ingestion/languages/cpp/adl.d.ts +141 -0
- package/dist/core/ingestion/languages/cpp/adl.js +478 -0
- package/dist/core/ingestion/languages/cpp/arity-metadata.d.ts +18 -0
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +170 -0
- package/dist/core/ingestion/languages/cpp/arity.d.ts +17 -0
- package/dist/core/ingestion/languages/cpp/arity.js +31 -0
- package/dist/core/ingestion/languages/cpp/captures.d.ts +2 -0
- package/dist/core/ingestion/languages/cpp/captures.js +1131 -0
- package/dist/core/ingestion/languages/cpp/conversion-rank.d.ts +31 -0
- package/dist/core/ingestion/languages/cpp/conversion-rank.js +47 -0
- package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +118 -0
- package/dist/core/ingestion/languages/cpp/file-local-linkage.js +266 -0
- package/dist/core/ingestion/languages/cpp/header-scan.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/header-scan.js +50 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +19 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.js +111 -0
- package/dist/core/ingestion/languages/cpp/import-target.d.ts +10 -0
- package/dist/core/ingestion/languages/cpp/import-target.js +13 -0
- package/dist/core/ingestion/languages/cpp/index.d.ts +11 -0
- package/dist/core/ingestion/languages/cpp/index.js +11 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +67 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +176 -0
- package/dist/core/ingestion/languages/cpp/interpret.d.ts +35 -0
- package/dist/core/ingestion/languages/cpp/interpret.js +113 -0
- package/dist/core/ingestion/languages/cpp/merge-bindings.d.ts +13 -0
- package/dist/core/ingestion/languages/cpp/merge-bindings.js +29 -0
- package/dist/core/ingestion/languages/cpp/query.d.ts +3 -0
- package/dist/core/ingestion/languages/cpp/query.js +508 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.d.ts +20 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.js +212 -0
- package/dist/core/ingestion/languages/cpp/scope-resolver.d.ts +17 -0
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +246 -0
- package/dist/core/ingestion/languages/cpp/simple-hooks.d.ts +24 -0
- package/dist/core/ingestion/languages/cpp/simple-hooks.js +62 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +76 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +195 -0
- package/dist/core/ingestion/languages/java/arity-metadata.d.ts +18 -0
- package/dist/core/ingestion/languages/java/arity-metadata.js +40 -0
- package/dist/core/ingestion/languages/java/arity.d.ts +10 -0
- package/dist/core/ingestion/languages/java/arity.js +24 -0
- package/dist/core/ingestion/languages/java/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/java/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/java/captures.d.ts +17 -0
- package/dist/core/ingestion/languages/java/captures.js +187 -0
- package/dist/core/ingestion/languages/java/import-decomposer.d.ts +18 -0
- package/dist/core/ingestion/languages/java/import-decomposer.js +85 -0
- package/dist/core/ingestion/languages/java/import-target.d.ts +17 -0
- package/dist/core/ingestion/languages/java/import-target.js +100 -0
- package/dist/core/ingestion/languages/java/index.d.ts +29 -0
- package/dist/core/ingestion/languages/java/index.js +29 -0
- package/dist/core/ingestion/languages/java/interpret.d.ts +13 -0
- package/dist/core/ingestion/languages/java/interpret.js +131 -0
- package/dist/core/ingestion/languages/java/merge-bindings.d.ts +12 -0
- package/dist/core/ingestion/languages/java/merge-bindings.js +40 -0
- package/dist/core/ingestion/languages/java/query.d.ts +30 -0
- package/dist/core/ingestion/languages/java/query.js +192 -0
- package/dist/core/ingestion/languages/java/receiver-binding.d.ts +11 -0
- package/dist/core/ingestion/languages/java/receiver-binding.js +95 -0
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/java/scope-resolver.js +74 -0
- package/dist/core/ingestion/languages/java/simple-hooks.d.ts +13 -0
- package/dist/core/ingestion/languages/java/simple-hooks.js +34 -0
- package/dist/core/ingestion/languages/java.js +11 -0
- package/dist/core/ingestion/languages/php/arity-metadata.d.ts +28 -0
- package/dist/core/ingestion/languages/php/arity-metadata.js +63 -0
- package/dist/core/ingestion/languages/php/arity.d.ts +25 -0
- package/dist/core/ingestion/languages/php/arity.js +40 -0
- package/dist/core/ingestion/languages/php/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/php/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/php/captures.d.ts +34 -0
- package/dist/core/ingestion/languages/php/captures.js +739 -0
- package/dist/core/ingestion/languages/php/import-decomposer.d.ts +28 -0
- package/dist/core/ingestion/languages/php/import-decomposer.js +265 -0
- package/dist/core/ingestion/languages/php/import-target.d.ts +47 -0
- package/dist/core/ingestion/languages/php/import-target.js +100 -0
- package/dist/core/ingestion/languages/php/index.d.ts +68 -0
- package/dist/core/ingestion/languages/php/index.js +72 -0
- package/dist/core/ingestion/languages/php/interpret.d.ts +36 -0
- package/dist/core/ingestion/languages/php/interpret.js +241 -0
- package/dist/core/ingestion/languages/php/merge-bindings.d.ts +19 -0
- package/dist/core/ingestion/languages/php/merge-bindings.js +47 -0
- package/dist/core/ingestion/languages/php/namespace-siblings.d.ts +51 -0
- package/dist/core/ingestion/languages/php/namespace-siblings.js +288 -0
- package/dist/core/ingestion/languages/php/query.d.ts +32 -0
- package/dist/core/ingestion/languages/php/query.js +326 -0
- package/dist/core/ingestion/languages/php/receiver-binding.d.ts +36 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +128 -0
- package/dist/core/ingestion/languages/php/scope-resolver.d.ts +23 -0
- package/dist/core/ingestion/languages/php/scope-resolver.js +358 -0
- package/dist/core/ingestion/languages/php/simple-hooks.d.ts +42 -0
- package/dist/core/ingestion/languages/php/simple-hooks.js +111 -0
- package/dist/core/ingestion/languages/php.d.ts +0 -7
- package/dist/core/ingestion/languages/php.js +15 -0
- package/dist/core/ingestion/markdown-processor.js +6 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +1 -0
- package/dist/core/ingestion/model/symbol-table.js +3 -0
- package/dist/core/ingestion/parsing-processor.d.ts +22 -2
- package/dist/core/ingestion/parsing-processor.js +123 -50
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +54 -2
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +5 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +119 -11
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +14 -0
- package/dist/core/ingestion/pipeline.d.ts +13 -0
- package/dist/core/ingestion/registry-primary-flag.js +2 -0
- package/dist/core/ingestion/scope-extractor.js +4 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +167 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +3 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +1 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +12 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.d.ts +1 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +12 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +16 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +36 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +204 -13
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +1 -1
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +55 -4
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +186 -5
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +10 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +207 -9
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +13 -1
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +6 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +17 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +86 -8
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +30 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +90 -8
- package/dist/core/ingestion/tree-sitter-queries.d.ts +2 -2
- package/dist/core/ingestion/tree-sitter-queries.js +23 -0
- package/dist/core/ingestion/utils/ast-helpers.js +6 -1
- package/dist/core/ingestion/utils/template-arguments.d.ts +11 -0
- package/dist/core/ingestion/utils/template-arguments.js +65 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +3 -0
- package/dist/core/ingestion/workers/parse-worker.js +42 -1
- package/dist/core/lbug/lbug-adapter.d.ts +39 -0
- package/dist/core/lbug/lbug-adapter.js +348 -48
- package/dist/core/run-analyze.d.ts +2 -0
- package/dist/core/run-analyze.js +323 -29
- package/dist/core/search/hybrid-search.d.ts +3 -0
- package/dist/core/search/hybrid-search.js +23 -6
- package/dist/core/wiki/generator.js +4 -3
- package/dist/core/wiki/html-viewer.js +2 -1
- package/dist/core/wiki/llm-client.d.ts +4 -0
- package/dist/core/wiki/llm-client.js +3 -3
- package/dist/core/wiki/mermaid-sanitizer.d.ts +2 -0
- package/dist/core/wiki/mermaid-sanitizer.js +100 -0
- package/dist/mcp/local/local-backend.js +20 -7
- package/dist/storage/file-hash.d.ts +47 -0
- package/dist/storage/file-hash.js +86 -0
- package/dist/storage/parse-cache.d.ts +73 -0
- package/dist/storage/parse-cache.js +253 -0
- package/dist/storage/repo-manager.d.ts +41 -1
- package/dist/storage/repo-manager.js +61 -6
- package/hooks/claude/gitnexus-hook.cjs +42 -4
- package/hooks/claude/hook-db-lock-probe.cjs +238 -0
- package/hooks/claude/hook-lock.cjs +119 -0
- package/hooks/claude/win-rm-list-json.ps1 +76 -0
- package/package.json +1 -1
- package/scripts/build.js +6 -2
- package/vendor/node_modules/node-addon-api/node_addon_api.target.mk +16 -16
- package/vendor/node_modules/node-addon-api/node_addon_api_except.target.mk +16 -16
- package/vendor/node_modules/node-addon-api/node_addon_api_except_all.target.mk +16 -16
- package/vendor/node_modules/node-addon-api/node_addon_api_maybe.target.mk +16 -16
- package/web/assets/{agent-BpHQleHE.js → agent-D2kLt6Dl.js} +91 -91
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-BETj2x4g.js +1 -0
- package/web/assets/architectureDiagram-UL44E2DR-DvIkEGkp.js +36 -0
- package/web/assets/blockDiagram-7IZFK4PR-B4niSLvR.js +132 -0
- package/web/assets/{c4Diagram-DFAF54RM-DeJV1rCn.js → c4Diagram-Y2BXMSZH-DIzEXalR.js} +6 -6
- package/web/assets/chunk-2T2R6R2M-n6s9JZqv.js +4 -0
- package/web/assets/chunk-2UTLFMKG-CMBB1TMN.js +1 -0
- package/web/assets/{chunk-7RZVMHOQ-BdIU-RGO.js → chunk-3SSMPTDK-BzGeeheI.js} +1 -1
- package/web/assets/chunk-4R4BOZG6-mKhL59ul.js +159 -0
- package/web/assets/chunk-5IMINLNL-CnTLsXIV.js +1 -0
- package/web/assets/chunk-5VCL7Z4A-w1BCx98Z.js +1 -0
- package/web/assets/chunk-6764PJDD-ChwMM2z4.js +1 -0
- package/web/assets/chunk-67TQ5CYL-CChC2cAv.js +124 -0
- package/web/assets/chunk-7J6CGLKN-DT-b53FT.js +10 -0
- package/web/assets/chunk-7W6UQGC5-CgFyfZ6k.js +1 -0
- package/web/assets/chunk-AQ6EADP3-CCFje6lL.js +1 -0
- package/web/assets/{chunk-KSICW3F5-C2tZmXwv.js → chunk-AZZRMDJM-5E9ARdDQ.js} +1 -1
- package/web/assets/chunk-C62D2QBJ-CDAWj26E.js +1 -0
- package/web/assets/chunk-CEXFNPSA-D68Tk6ls.js +1 -0
- package/web/assets/chunk-INKRHTLW-ELpfuk9h.js +70 -0
- package/web/assets/chunk-J5EP6P6S-DxWW0yvu.js +1 -0
- package/web/assets/{chunk-AEOMTBSW-D7qjBMHW.js → chunk-JQRUD6KW-Dcq_Qnyy.js} +1 -1
- package/web/assets/chunk-KGFNY3KK-W-VR57xb.js +62 -0
- package/web/assets/chunk-KGYTTC2M-C6PHeuay.js +1 -0
- package/web/assets/chunk-KNLZD3CH-BuZBOcso.js +1 -0
- package/web/assets/chunk-KRXBNO2N-DH2NPM7I.js +1 -0
- package/web/assets/chunk-LCXTWHL2-CqJ0oo1x.js +231 -0
- package/web/assets/chunk-LII3EMHJ-3X33tCpU.js +1 -0
- package/web/assets/chunk-QA3QBVWF-D5Ha3GgB.js +2 -0
- package/web/assets/chunk-RERM46MO-DQNbXtfw.js +1 -0
- package/web/assets/chunk-RG4AUYOV-D0M6vdq9.js +206 -0
- package/web/assets/chunk-RKZBBQEN-BmTPLSyv.js +1 -0
- package/web/assets/chunk-RLI5ZMPA-DExu2DOK.js +1 -0
- package/web/assets/chunk-T2UQINTJ-kGYG7ppP.js +1 -0
- package/web/assets/chunk-T5OCTHI4--9wWpVws.js +1 -0
- package/web/assets/chunk-UP6H54XL-DsKdC6jC.js +1 -0
- package/web/assets/chunk-UXSXWOXI-DR81EqLr.js +1 -0
- package/web/assets/chunk-UY5QBCOK-Du-c56gs.js +1 -0
- package/web/assets/chunk-W44A43WB-lrCpuupA.js +1 -0
- package/web/assets/chunk-ZXARS5L4-CSZRiyOf.js +1 -0
- package/web/assets/classDiagram-KGZ6W3CR-BB-saqC1.js +1 -0
- package/web/assets/classDiagram-v2-72OJOZXJ-Bp2bAlS5.js +1 -0
- package/web/assets/cose-bilkent-UX7MHV2Q-BHv2bbtl.js +1 -0
- package/web/assets/dagre-ND4H6XIP-DsIr9MOv.js +4 -0
- package/web/assets/diagram-3NCE3AQN-BUxnDPOY.js +43 -0
- package/web/assets/diagram-GF46GFSD-BJTyqqvI.js +24 -0
- package/web/assets/diagram-HNR7UZ2L-fUWreZzx.js +3 -0
- package/web/assets/diagram-QXG6HAR7-DilMHamP.js +24 -0
- package/web/assets/diagram-WEQXMOUZ-8KUrarg1.js +10 -0
- package/web/assets/erDiagram-L5TCEMPS-Doj9mSiW.js +85 -0
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-B3myHUst.js +1 -0
- package/web/assets/{flowDiagram-OTCZ4VVT-aAZw4c_M.js → flowDiagram-H6V6AXG4-BOSR-i3p.js} +12 -12
- package/web/assets/ganttDiagram-JCBTUEKG-BHQssTz6.js +292 -0
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-DF3rtf4A.js +1 -0
- package/web/assets/gitGraphDiagram-S2ZK5IYY-CCwVLT__.js +106 -0
- package/web/assets/index-j4-NuleT.js +623 -0
- package/web/assets/info-J43DQDTF-KCYPFFUO-R4XV_akJ.js +1 -0
- package/web/assets/infoDiagram-3YFTVSEB-Ce_TvtaV.js +2 -0
- package/web/assets/{ishikawaDiagram-YMYX4NHK-BF8AtDaj.js → ishikawaDiagram-BNXS4ZKH-4MXIDCSF.js} +6 -6
- package/web/assets/journeyDiagram-M6C3CM3L-DNPYCpvq.js +139 -0
- package/web/assets/kanban-definition-75IXJCU3-yYdfm8Kk.js +89 -0
- package/web/assets/{katex-GD7MH7QM-CJiOjBBJ.js → katex-K3KEBU37-CrVLz8l7.js} +1 -1
- package/web/assets/mindmap-definition-2TDM6QVE-DFNEKM77.js +96 -0
- package/web/assets/packet-YPE3B663-LP52Z2RK-CgQPdNZa.js +1 -0
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-BzWOwc_c.js +1 -0
- package/web/assets/pieDiagram-CU6KROY3-iZAqpvhd.js +30 -0
- package/web/assets/quadrantDiagram-VICAPDV7-bAm6Hi_5.js +7 -0
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-B7KG0FN7.js +1 -0
- package/web/assets/requirementDiagram-JXO7QTGE-CtDijhnf.js +84 -0
- package/web/assets/sankeyDiagram-URQDO5SZ-LFJz53u5.js +40 -0
- package/web/assets/sequenceDiagram-VS2MUI6T-BdjvyCHM.js +162 -0
- package/web/assets/stateDiagram-7D4R322I-e5odN9fG.js +1 -0
- package/web/assets/stateDiagram-v2-36443NZ5-vPsvjR2D.js +1 -0
- package/web/assets/timeline-definition-O6YCAMPW-DPAksNQp.js +120 -0
- package/web/assets/treeView-BLDUP644-QA4HXRO3-CRSxEwLO.js +1 -0
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-a0PfKoVn.js +1 -0
- package/web/assets/vennDiagram-MWXL3ELB-Dtlfdt7J.js +34 -0
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-BKQ6e5mC.js +1 -0
- package/web/assets/wardleyDiagram-CUQ6CDDI-B23uRMUC.js +78 -0
- package/web/assets/{xychartDiagram-ZHJ5623Y-DZ7fP1_3.js → xychartDiagram-N2JHSOCM-DxwHeksW.js} +6 -6
- package/web/index.html +13 -2
- package/web/assets/architecture-YZFGNWBL-S5CXDPWN-BUzkWgDl.js +0 -1
- package/web/assets/architectureDiagram-EMZXCZ2Q-CXbzok1G.js +0 -36
- package/web/assets/blockDiagram-IGV67L2C-DA1QJ4ZB.js +0 -132
- package/web/assets/chunk-3GS5O3IE-B8hpnia8.js +0 -231
- package/web/assets/chunk-3YCYZ6SJ-B-BVu21C.js +0 -1
- package/web/assets/chunk-6NTNNK5N-DW-jYSDr.js +0 -1
- package/web/assets/chunk-A34GCYZU-BbZl-IKy.js +0 -1
- package/web/assets/chunk-DJ7UZH7F-B5tMfF87.js +0 -1
- package/web/assets/chunk-DKKBVRCY-Djm-6K_e.js +0 -4
- package/web/assets/chunk-DU5LTGQ6-QPoynYcp.js +0 -1
- package/web/assets/chunk-FXACKDTF-jieSmbe2.js +0 -159
- package/web/assets/chunk-H3VCZNTA-8EMHZ3SV.js +0 -1
- package/web/assets/chunk-HN6EAY2L-CgE_agsD.js +0 -1
- package/web/assets/chunk-O5ABG6QK-DEZV1O19.js +0 -1
- package/web/assets/chunk-PK6DOVAG-BXv0JnsJ.js +0 -206
- package/web/assets/chunk-RNJOYNJ4-BiBkF9dN.js +0 -1
- package/web/assets/chunk-RWUO3TPN-DTWzAhQ1.js +0 -1
- package/web/assets/chunk-TBF5ZNIQ-BSl6s9lT.js +0 -1
- package/web/assets/chunk-TU3PZOEN-DE5Qhc0N.js +0 -1
- package/web/assets/chunk-TYMNRAUI-D1NDLIMG.js +0 -1
- package/web/assets/chunk-VELTKBKT-C9dVN39o.js +0 -1
- package/web/assets/chunk-W7ZLLLMY-Bu-cdLzs.js +0 -1
- package/web/assets/chunk-WSB5WSVC-Dor71SOz.js +0 -1
- package/web/assets/chunk-XGPFEOL4-CUonLRle.js +0 -1
- package/web/assets/classDiagram-PPOCWD7C-Cdd6UdVv.js +0 -1
- package/web/assets/classDiagram-v2-23LJLIIU-DNhxY2Ib.js +0 -1
- package/web/assets/cose-bilkent-PNC4W37J-DdZq7Qz_.js +0 -1
- package/web/assets/dagre-E77IOHMT-Cfj_6e17.js +0 -4
- package/web/assets/diagram-H7BISOXX-BNvpsrBv.js +0 -43
- package/web/assets/diagram-JC5VWROH-Cn0rtDbJ.js +0 -24
- package/web/assets/diagram-LXUTUG65-CHfoVKNm.js +0 -10
- package/web/assets/diagram-WEHSV5V5-BLxHksnu.js +0 -24
- package/web/assets/erDiagram-GCSMX5X6-DfdN6iqF.js +0 -85
- package/web/assets/ganttDiagram-MUNLMDZQ-BEfC_7Or.js +0 -292
- package/web/assets/gitGraph-7Q5UKJZL-54BCDZD5-B6ZeRLP0.js +0 -1
- package/web/assets/gitGraphDiagram-3HKGZ4G3-CG0kC8Q5.js +0 -106
- package/web/assets/index-3NUCUW2s.js +0 -886
- package/web/assets/info-OMHHGYJF-BF2H5H6G-BIOsZy0W.js +0 -1
- package/web/assets/infoDiagram-MN7RKWGX-DUoMH-pq.js +0 -2
- package/web/assets/journeyDiagram-SO5T7YLQ-BW8oKa3N.js +0 -139
- package/web/assets/kanban-definition-LJHFXRCJ-DzbOsR-2.js +0 -89
- package/web/assets/mindmap-definition-2EUWGEK5-BIXGQALq.js +0 -96
- package/web/assets/packet-4T2RLAQJ-EV4IVRXR-Bs7ysNMU.js +0 -1
- package/web/assets/pie-ZZUOXDRM-N23DN5KN-Csi8nnbH.js +0 -1
- package/web/assets/pieDiagram-3IATQBI2-QY-u7P6a.js +0 -30
- package/web/assets/quadrantDiagram-E256RVCF-Di4aNiU8.js +0 -7
- package/web/assets/radar-PYXPWWZC-P6TP7ZYP-DJlyXh2-.js +0 -1
- package/web/assets/requirementDiagram-M5DCFWZL-CzUUrhQD.js +0 -84
- package/web/assets/sankeyDiagram-L3NBLAOT-D2fbMiIU.js +0 -10
- package/web/assets/sequenceDiagram-ZOUHS735-BNdkqguh.js +0 -157
- package/web/assets/stateDiagram-MLPALWAM-51_Q2w2L.js +0 -1
- package/web/assets/stateDiagram-v2-B5LQ5ZB2-8nHs2aNE.js +0 -1
- package/web/assets/timeline-definition-5SPVSISX-DkMiGj4Z.js +0 -120
- package/web/assets/treeView-SZITEDCU-5DXDK3XO-Cy6P0_CZ.js +0 -1
- package/web/assets/treemap-W4RFUUIX-WYLRDWKO-C_pp1R7A.js +0 -1
- package/web/assets/vennDiagram-IE5QUKF5-BCxMmf9q.js +0 -34
- package/web/assets/wardley-RL74JXVD-BCRCBASE-CMStJhpn.js +0 -1
- package/web/assets/wardleyDiagram-XU3VSMPF-ijlLF77s.js +0 -20
- /package/web/assets/{context-builder-CqQNhRj1.js → context-builder-_HS0v2ma.js} +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { getCppParser } from './query.js';
|
|
2
|
+
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
3
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Populate range-for loop variable type bindings for C++.
|
|
6
|
+
*
|
|
7
|
+
* Handles three patterns:
|
|
8
|
+
* 1. `for (auto& user : users)` — simple range-for
|
|
9
|
+
* 2. `for (auto& [key, user] : userMap)` — structured binding
|
|
10
|
+
* 3. `for (auto& user : *usersPtr)` — dereference range-for
|
|
11
|
+
*
|
|
12
|
+
* Strategy: look up the range source variable's type in scope
|
|
13
|
+
* typeBindings, extract the last template argument as the element
|
|
14
|
+
* type, and inject a typeBinding for the loop variable.
|
|
15
|
+
*/
|
|
16
|
+
export function populateCppRangeBindings(parsedFiles, _indexes, ctx) {
|
|
17
|
+
const parser = getCppParser();
|
|
18
|
+
for (const parsed of parsedFiles) {
|
|
19
|
+
const sourceText = ctx.fileContents.get(parsed.filePath);
|
|
20
|
+
if (sourceText === undefined)
|
|
21
|
+
continue;
|
|
22
|
+
const cachedTree = ctx.treeCache?.get(parsed.filePath);
|
|
23
|
+
const tree = cachedTree ??
|
|
24
|
+
parseSourceSafe(parser, sourceText, undefined, {
|
|
25
|
+
bufferSize: getTreeSitterBufferSize(sourceText),
|
|
26
|
+
});
|
|
27
|
+
const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
|
|
28
|
+
if (moduleScope === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
const scopeMap = new Map(parsed.scopes.map((s) => [s.id, s]));
|
|
31
|
+
// Build a map from parameter name → AST parameter_declaration node
|
|
32
|
+
// so we can extract the un-normalized template type from the AST.
|
|
33
|
+
const paramTypeMap = buildParamTemplateMap(tree.rootNode);
|
|
34
|
+
for (const rangeNode of tree.rootNode.descendantsOfType('for_range_loop')) {
|
|
35
|
+
// Get the declarator (loop variable)
|
|
36
|
+
const declarator = rangeNode.childForFieldName('declarator');
|
|
37
|
+
if (declarator === null)
|
|
38
|
+
continue;
|
|
39
|
+
// Get the range source expression (right side of ':')
|
|
40
|
+
const right = rangeNode.childForFieldName('right');
|
|
41
|
+
if (right === null)
|
|
42
|
+
continue;
|
|
43
|
+
// Determine the loop variable name(s) and whether this is a structured binding
|
|
44
|
+
const varNames = extractLoopVarNames(declarator);
|
|
45
|
+
if (varNames.length === 0)
|
|
46
|
+
continue;
|
|
47
|
+
// Determine the range source variable name (handle dereference)
|
|
48
|
+
const sourceVarName = extractSourceVarName(right);
|
|
49
|
+
if (sourceVarName === null)
|
|
50
|
+
continue;
|
|
51
|
+
// Look up the source variable's full template type from the AST
|
|
52
|
+
// (scope typeBindings have been normalized and lost template params)
|
|
53
|
+
const fullType = paramTypeMap.get(sourceVarName);
|
|
54
|
+
if (fullType === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
// Extract element type from the container type
|
|
57
|
+
const elementType = extractCppElementType(fullType);
|
|
58
|
+
if (elementType === null)
|
|
59
|
+
continue;
|
|
60
|
+
// Find the enclosing function scope
|
|
61
|
+
const functionScope = findEnclosingFunctionScope(rangeNode, scopeMap);
|
|
62
|
+
const targetScope = functionScope ?? moduleScope;
|
|
63
|
+
const mutable = targetScope.typeBindings;
|
|
64
|
+
// For structured binding [key, user], bind the last identifier to the element type
|
|
65
|
+
// For simple range-for, bind the single variable
|
|
66
|
+
const bindVar = varNames[varNames.length - 1];
|
|
67
|
+
mutable.set(bindVar, {
|
|
68
|
+
rawName: elementType,
|
|
69
|
+
declaredAtScope: targetScope.id,
|
|
70
|
+
source: 'annotation',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build a map from parameter name → full (un-normalized) type text
|
|
77
|
+
* by walking the AST for all `parameter_declaration` nodes.
|
|
78
|
+
*
|
|
79
|
+
* This bypasses `normalizeCppTypeName` which strips template params,
|
|
80
|
+
* giving us the raw `std::vector<User>` text needed for element-type
|
|
81
|
+
* extraction.
|
|
82
|
+
*/
|
|
83
|
+
function buildParamTemplateMap(rootNode) {
|
|
84
|
+
const map = new Map();
|
|
85
|
+
for (const paramNode of rootNode.descendantsOfType('parameter_declaration')) {
|
|
86
|
+
const typeNode = paramNode.childForFieldName('type');
|
|
87
|
+
if (typeNode === null)
|
|
88
|
+
continue;
|
|
89
|
+
// Extract the parameter name from the declarator subtree.
|
|
90
|
+
// The declarator may be: identifier, reference_declarator > identifier,
|
|
91
|
+
// or pointer_declarator > identifier.
|
|
92
|
+
const declNode = paramNode.childForFieldName('declarator');
|
|
93
|
+
if (declNode === null)
|
|
94
|
+
continue;
|
|
95
|
+
const idents = declNode.descendantsOfType('identifier');
|
|
96
|
+
if (idents.length === 0)
|
|
97
|
+
continue;
|
|
98
|
+
const paramName = idents[idents.length - 1].text;
|
|
99
|
+
// Use the full type node text (preserving template params)
|
|
100
|
+
map.set(paramName, typeNode.text);
|
|
101
|
+
}
|
|
102
|
+
return map;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Extract loop variable name(s) from the declarator node.
|
|
106
|
+
* Handles both simple `identifier` and `structured_binding_declarator`.
|
|
107
|
+
*/
|
|
108
|
+
function extractLoopVarNames(declarator) {
|
|
109
|
+
// The declarator is typically reference_declarator or pointer_declarator wrapping
|
|
110
|
+
// either an identifier or a structured_binding_declarator.
|
|
111
|
+
const structBindings = declarator.descendantsOfType('structured_binding_declarator');
|
|
112
|
+
if (structBindings.length > 0) {
|
|
113
|
+
// structured_binding_declarator contains identifiers like [key, user]
|
|
114
|
+
const idents = structBindings[0].descendantsOfType('identifier');
|
|
115
|
+
return idents.map((id) => id.text).filter((t) => t !== '_');
|
|
116
|
+
}
|
|
117
|
+
// Simple case: reference_declarator > identifier or just identifier
|
|
118
|
+
const idents = declarator.descendantsOfType('identifier');
|
|
119
|
+
if (idents.length > 0) {
|
|
120
|
+
return [idents[idents.length - 1].text];
|
|
121
|
+
}
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Extract the source variable name from the range expression.
|
|
126
|
+
* Handles plain identifiers and dereference expressions (*ptr).
|
|
127
|
+
*/
|
|
128
|
+
function extractSourceVarName(right) {
|
|
129
|
+
if (right.type === 'identifier') {
|
|
130
|
+
return right.text;
|
|
131
|
+
}
|
|
132
|
+
if (right.type === 'pointer_expression') {
|
|
133
|
+
// *usersPtr → get the argument (usersPtr)
|
|
134
|
+
const arg = right.childForFieldName('argument');
|
|
135
|
+
if (arg !== null)
|
|
136
|
+
return arg.text;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Extract the element type from a C++ container type string.
|
|
142
|
+
*
|
|
143
|
+
* Examples:
|
|
144
|
+
* - `vector<User>` → `User`
|
|
145
|
+
* - `std::vector<User>` → `User`
|
|
146
|
+
* - `map<std::string, User>` → `User` (last template arg)
|
|
147
|
+
* - `map<string, User>` → `User`
|
|
148
|
+
*
|
|
149
|
+
* For structured bindings with maps, the last template arg is the value type.
|
|
150
|
+
* For vectors/sets, the first (and only) template arg is the element type.
|
|
151
|
+
*/
|
|
152
|
+
function extractCppElementType(rawType) {
|
|
153
|
+
// Find the outermost template argument list
|
|
154
|
+
const ltIdx = rawType.indexOf('<');
|
|
155
|
+
if (ltIdx === -1)
|
|
156
|
+
return null;
|
|
157
|
+
// Extract the template argument string (handle nested templates)
|
|
158
|
+
let depth = 0;
|
|
159
|
+
let lastCommaOrStart = ltIdx + 1;
|
|
160
|
+
let lastArg = '';
|
|
161
|
+
for (let i = ltIdx; i < rawType.length; i++) {
|
|
162
|
+
const ch = rawType[i];
|
|
163
|
+
if (ch === '<') {
|
|
164
|
+
depth++;
|
|
165
|
+
}
|
|
166
|
+
else if (ch === '>') {
|
|
167
|
+
depth--;
|
|
168
|
+
if (depth === 0) {
|
|
169
|
+
lastArg = rawType.slice(lastCommaOrStart, i).trim();
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else if (ch === ',' && depth === 1) {
|
|
174
|
+
lastCommaOrStart = i + 1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (lastArg === '')
|
|
178
|
+
return null;
|
|
179
|
+
// Strip pointer/reference qualifiers and const
|
|
180
|
+
let elementType = lastArg
|
|
181
|
+
.replace(/^const\s+/, '')
|
|
182
|
+
.replace(/\s*[*&]+\s*$/, '')
|
|
183
|
+
.trim();
|
|
184
|
+
// Strip namespace prefix (std::string → string)
|
|
185
|
+
const lastColon = elementType.lastIndexOf('::');
|
|
186
|
+
if (lastColon !== -1) {
|
|
187
|
+
elementType = elementType.slice(lastColon + 2);
|
|
188
|
+
}
|
|
189
|
+
return elementType || null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Find the enclosing Function scope for a tree-sitter node by
|
|
193
|
+
* walking up the AST and matching source positions.
|
|
194
|
+
*/
|
|
195
|
+
function findEnclosingFunctionScope(node, scopeMap) {
|
|
196
|
+
const tsNode = node;
|
|
197
|
+
let current = tsNode;
|
|
198
|
+
while (current !== null) {
|
|
199
|
+
if (current.type === 'function_definition') {
|
|
200
|
+
for (const scope of scopeMap.values()) {
|
|
201
|
+
if (scope.kind === 'Function' &&
|
|
202
|
+
scope.range.startLine === current.startPosition.row &&
|
|
203
|
+
scope.range.startCol === current.startPosition.column) {
|
|
204
|
+
return scope;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
current = current.parent ?? null;
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
|
2
|
+
/**
|
|
3
|
+
* C++ `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
4
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
5
|
+
*
|
|
6
|
+
* C++ extends C's scope resolution with:
|
|
7
|
+
* - Namespaces (`namespace foo { ... }`)
|
|
8
|
+
* - Classes with methods and multiple inheritance
|
|
9
|
+
* - `using namespace` (wildcard import from namespace)
|
|
10
|
+
* - `using X::name` (named import from namespace)
|
|
11
|
+
* - Anonymous namespace (file-local linkage, like C `static`)
|
|
12
|
+
* - Default parameters (requiredParameterCount < parameterCount)
|
|
13
|
+
* - Overloading (arity-based disambiguation)
|
|
14
|
+
* - Templates (V1: generic-ignored, `List<User>` ≡ `List`)
|
|
15
|
+
* - Leftmost-base MRO for multiple inheritance
|
|
16
|
+
*/
|
|
17
|
+
export declare const cppScopeResolver: ScopeResolver;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { findClassBindingInScope, findEnclosingClassDef, } from '../../scope-resolution/scope/walkers.js';
|
|
2
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
3
|
+
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
|
4
|
+
import { populateClassOwnedMembers } from '../../scope-resolution/scope/walkers.js';
|
|
5
|
+
import { cppProvider } from '../c-cpp.js';
|
|
6
|
+
import { cppArityCompatibility } from './arity.js';
|
|
7
|
+
import { cppConversionRank } from './conversion-rank.js';
|
|
8
|
+
import { cppMergeBindings } from './merge-bindings.js';
|
|
9
|
+
import { resolveCppImportTarget } from './import-target.js';
|
|
10
|
+
import { scanCppHeaderFiles } from './header-scan.js';
|
|
11
|
+
import { expandCppWildcardNames, isFileLocal, clearFileLocalNames, populateCppAnonymousNamespaceScopes, populateCppNonGloballyVisible, isCppDefGloballyVisible, } from './file-local-linkage.js';
|
|
12
|
+
import { populateCppDependentBases, clearCppDependentBases, isCppDependentBaseMember, } from './two-phase-lookup.js';
|
|
13
|
+
import { populateCppAssociatedNamespaces, clearCppAdlState, pickCppAdlCandidates } from './adl.js';
|
|
14
|
+
import { clearCppInlineNamespaces, populateCppInlineNamespaceScopes, resolveCppQualifiedNamespaceMember, } from './inline-namespaces.js';
|
|
15
|
+
import { populateCppRangeBindings } from './range-bindings.js';
|
|
16
|
+
/**
|
|
17
|
+
* C++ `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
18
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
19
|
+
*
|
|
20
|
+
* C++ extends C's scope resolution with:
|
|
21
|
+
* - Namespaces (`namespace foo { ... }`)
|
|
22
|
+
* - Classes with methods and multiple inheritance
|
|
23
|
+
* - `using namespace` (wildcard import from namespace)
|
|
24
|
+
* - `using X::name` (named import from namespace)
|
|
25
|
+
* - Anonymous namespace (file-local linkage, like C `static`)
|
|
26
|
+
* - Default parameters (requiredParameterCount < parameterCount)
|
|
27
|
+
* - Overloading (arity-based disambiguation)
|
|
28
|
+
* - Templates (V1: generic-ignored, `List<User>` ≡ `List`)
|
|
29
|
+
* - Leftmost-base MRO for multiple inheritance
|
|
30
|
+
*/
|
|
31
|
+
export const cppScopeResolver = {
|
|
32
|
+
language: SupportedLanguages.CPlusPlus,
|
|
33
|
+
languageProvider: cppProvider,
|
|
34
|
+
importEdgeReason: 'cpp-scope: include',
|
|
35
|
+
loadResolutionConfig: (repoPath) => {
|
|
36
|
+
// Clear stale per-pipeline state from any previous invocation.
|
|
37
|
+
clearFileLocalNames();
|
|
38
|
+
clearCppDependentBases();
|
|
39
|
+
clearCppAdlState();
|
|
40
|
+
clearCppInlineNamespaces();
|
|
41
|
+
return scanCppHeaderFiles(repoPath);
|
|
42
|
+
},
|
|
43
|
+
resolveImportTarget: (targetRaw, fromFile, allFilePaths, resolutionConfig) => {
|
|
44
|
+
// Augment allFilePaths with header files discovered via loadResolutionConfig.
|
|
45
|
+
// C++ .h/.hpp/.hxx/.hh files may be classified differently by language
|
|
46
|
+
// detection but are importable from .cpp files via #include.
|
|
47
|
+
const headerPaths = resolutionConfig;
|
|
48
|
+
if (headerPaths !== undefined && headerPaths.size > 0) {
|
|
49
|
+
const augmented = new Set(allFilePaths);
|
|
50
|
+
for (const h of headerPaths)
|
|
51
|
+
augmented.add(h);
|
|
52
|
+
return resolveCppImportTarget(targetRaw, fromFile, augmented);
|
|
53
|
+
}
|
|
54
|
+
return resolveCppImportTarget(targetRaw, fromFile, allFilePaths);
|
|
55
|
+
},
|
|
56
|
+
expandsWildcardTo: (targetModuleScope, parsedFiles) => expandCppWildcardNames(targetModuleScope, parsedFiles),
|
|
57
|
+
mergeBindings: (existing, incoming, scopeId) => cppMergeBindings(existing, incoming, scopeId),
|
|
58
|
+
// Adapter: cppArityCompatibility predates ScopeResolver and uses
|
|
59
|
+
// (def, callsite). ScopeResolver contract is (callsite, def).
|
|
60
|
+
arityCompatibility: (callsite, def) => cppArityCompatibility(def, callsite),
|
|
61
|
+
buildMro: (graph, parsedFiles, nodeLookup) => buildMro(graph, parsedFiles, nodeLookup, defaultLinearize),
|
|
62
|
+
populateOwners: (parsed) => {
|
|
63
|
+
populateClassOwnedMembers(parsed);
|
|
64
|
+
// Resolve inline- and anonymous-namespace ranges (recorded at capture
|
|
65
|
+
// time) to ScopeIds BEFORE `populateCppNonGloballyVisible` runs, so
|
|
66
|
+
// both exemptions see the populated Sets.
|
|
67
|
+
populateCppInlineNamespaceScopes(parsed);
|
|
68
|
+
populateCppAnonymousNamespaceScopes(parsed);
|
|
69
|
+
// Track namespace-nested and class-nested defs so the global free-call
|
|
70
|
+
// fallback and wildcard expansion can suppress them as unqualified
|
|
71
|
+
// cross-file callables.
|
|
72
|
+
populateCppNonGloballyVisible(parsed);
|
|
73
|
+
// Build the class-def → enclosing-namespace-qualified-name map used
|
|
74
|
+
// by ADL (U2 of plan 2026-05-13-001) to identify each argument type's
|
|
75
|
+
// associated namespace for Koenig lookup.
|
|
76
|
+
populateCppAssociatedNamespaces(parsed);
|
|
77
|
+
},
|
|
78
|
+
// Resolve recorded template-class → dependent-base simple names to
|
|
79
|
+
// class nodeIds for two-phase template lookup (U3 of plan
|
|
80
|
+
// 2026-05-13-001). Runs AFTER all files have had `populateOwners`
|
|
81
|
+
// applied so that cross-file base classes (e.g. Base in base.h,
|
|
82
|
+
// Derived in derived.h) are reachable in the workspace index.
|
|
83
|
+
populateWorkspaceOwners: (parsedFiles) => {
|
|
84
|
+
populateCppDependentBases(parsedFiles);
|
|
85
|
+
},
|
|
86
|
+
// Simple `isSuperReceiver` returns false for C++. Real super
|
|
87
|
+
// classification is caller-context-dependent and lives in
|
|
88
|
+
// `isSuperReceiverInContext` below — without scope context the
|
|
89
|
+
// previous regex `/^[A-Z]\w*::/` misclassified namespace-qualified
|
|
90
|
+
// calls (e.g., `Singleton::getInstance()`) as super calls and routed
|
|
91
|
+
// them through the wrong resolution branch.
|
|
92
|
+
isSuperReceiver: () => false,
|
|
93
|
+
isSuperReceiverInContext: (text, callerScope, scopes) => {
|
|
94
|
+
// The receiver text comes from the LHS of `::` in `qualified_identifier`
|
|
95
|
+
// (e.g., for `Base<T>::method()`, text is `Base<T>`). Strip template
|
|
96
|
+
// arguments (V1: name-only matching, generics ignored) and any leading
|
|
97
|
+
// namespace qualifier so the lookup matches the bare class def's
|
|
98
|
+
// simple name. `Base<T>::method()` → `Base`; `outer::v1::Base<T>` →
|
|
99
|
+
// `Base`. This handles the Phase 5 cross-unit composition where
|
|
100
|
+
// qualified base-method calls appear inside template bodies.
|
|
101
|
+
let lhs = text;
|
|
102
|
+
const sepIdx = lhs.indexOf('::');
|
|
103
|
+
if (sepIdx > 0)
|
|
104
|
+
lhs = lhs.slice(0, sepIdx).trim();
|
|
105
|
+
// Strip trailing template-argument list (greedy: drop everything from
|
|
106
|
+
// the first `<` onward — V1 ignores generics).
|
|
107
|
+
const lt = lhs.indexOf('<');
|
|
108
|
+
if (lt > 0)
|
|
109
|
+
lhs = lhs.slice(0, lt).trim();
|
|
110
|
+
// Strip nested namespace prefix from the receiver text itself (the
|
|
111
|
+
// `outer::v1::Base` shape that appears in derived-list `base_class_clause`).
|
|
112
|
+
const lastDoubleColon = lhs.lastIndexOf('::');
|
|
113
|
+
if (lastDoubleColon >= 0)
|
|
114
|
+
lhs = lhs.slice(lastDoubleColon + 2).trim();
|
|
115
|
+
if (lhs.length === 0)
|
|
116
|
+
return false;
|
|
117
|
+
// Resolve the LHS in the caller's scope chain. Only class-like
|
|
118
|
+
// resolutions can be super receivers; Namespace and unresolved
|
|
119
|
+
// names are not super calls.
|
|
120
|
+
const lhsDef = findClassBindingInScope(callerScope, lhs, scopes);
|
|
121
|
+
if (lhsDef === undefined)
|
|
122
|
+
return false;
|
|
123
|
+
// The caller must have an enclosing class — super calls only make
|
|
124
|
+
// sense inside a class body. Free functions can use `ClassName::`
|
|
125
|
+
// for namespace-qualified calls but those are not super.
|
|
126
|
+
const enclosing = findEnclosingClassDef(callerScope, scopes);
|
|
127
|
+
if (enclosing === undefined)
|
|
128
|
+
return false;
|
|
129
|
+
// `lhsDef` must be in the caller's MRO (i.e., the caller's enclosing
|
|
130
|
+
// class derives from it). The class itself counts as its own MRO
|
|
131
|
+
// root — `Self::method()` is a qualified self-call, not a super
|
|
132
|
+
// call, so exclude the caller's own class.
|
|
133
|
+
if (lhsDef.nodeId === enclosing.nodeId)
|
|
134
|
+
return false;
|
|
135
|
+
const mro = scopes.methodDispatch.mroFor(enclosing.nodeId);
|
|
136
|
+
return mro.includes(lhsDef.nodeId);
|
|
137
|
+
},
|
|
138
|
+
// C++ is statically typed — disable field fallback heuristic
|
|
139
|
+
fieldFallbackOnMethodLookup: false,
|
|
140
|
+
// C++ needs return type propagation across #include boundaries
|
|
141
|
+
propagatesReturnTypesAcrossImports: true,
|
|
142
|
+
// C++ #include brings in all symbols — enable global free call fallback
|
|
143
|
+
allowGlobalFreeCallFallback: true,
|
|
144
|
+
// C++ standard-conversion-sequence ranking for overload resolution (#1578).
|
|
145
|
+
// Disambiguates `f(int)` vs `f(double)` called with `f(2.5)` by scoring
|
|
146
|
+
// each candidate's conversion cost; exact match wins over standard conversion.
|
|
147
|
+
conversionRankFn: cppConversionRank,
|
|
148
|
+
// Range-for element type inference: for (auto& user : users) → bind user to User
|
|
149
|
+
populateRangeBindings: populateCppRangeBindings,
|
|
150
|
+
// C++ method return-type bindings need to be visible from module scope
|
|
151
|
+
// for cross-file propagation and compound-receiver chain resolution.
|
|
152
|
+
// cppBindingScopeFor hoists @type-binding.return to Module scope.
|
|
153
|
+
hoistTypeBindingsToModule: true,
|
|
154
|
+
// Enable receiver-bound explicit-`this` fallback only for C++.
|
|
155
|
+
resolveThisViaEnclosingClass: true,
|
|
156
|
+
// The `isFileLocalDef` hook on the global free-call fallback names
|
|
157
|
+
// file-local linkage historically, but semantically gates "logically
|
|
158
|
+
// invisible cross-file" defs. C++ extends this to also reject class-
|
|
159
|
+
// owned methods/fields and namespace-nested symbols — an unqualified
|
|
160
|
+
// call from a free function MUST NOT resolve to `User::save` or
|
|
161
|
+
// `ns::foo` (Cppreference, "Unqualified name lookup"). Without this
|
|
162
|
+
// gate, the global fallback walks every callable in the workspace
|
|
163
|
+
// registry and matches any class method or namespace function by
|
|
164
|
+
// simple name.
|
|
165
|
+
isFileLocalDef: (def) => {
|
|
166
|
+
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
167
|
+
if (isFileLocal(def.filePath, simple))
|
|
168
|
+
return true;
|
|
169
|
+
// Class-owned (Method/Field) — `populateClassOwnedMembers` already
|
|
170
|
+
// stamps `ownerId`; cheap fast-path before consulting the scope map.
|
|
171
|
+
if (def.ownerId !== undefined)
|
|
172
|
+
return true;
|
|
173
|
+
// Namespace-nested defs — require qualification cross-file. Scope-
|
|
174
|
+
// walked at `populateOwners` time into a per-file nodeId set.
|
|
175
|
+
if (!isCppDefGloballyVisible(def.filePath, def.nodeId))
|
|
176
|
+
return true;
|
|
177
|
+
return false;
|
|
178
|
+
},
|
|
179
|
+
// C++ two-phase template lookup: inside a class template body,
|
|
180
|
+
// unqualified calls MUST NOT bind to members of a dependent base
|
|
181
|
+
// class. The standard requires `this->name()` or `Base<T>::name()`
|
|
182
|
+
// forms to make the lookup dependent. Without this gate the global
|
|
183
|
+
// free-call fallback walks the workspace registry and silently binds
|
|
184
|
+
// unqualified calls to dependent-base members, producing CALLS edges
|
|
185
|
+
// the compiler would reject. See plan 2026-05-13-001 U3.
|
|
186
|
+
isCallableVisibleFromCaller: ({ candidate, callerScope, scopes }) => {
|
|
187
|
+
if (callerScope === undefined || scopes === undefined)
|
|
188
|
+
return true;
|
|
189
|
+
// Reject when the candidate is a member of a dependent base of the
|
|
190
|
+
// caller's enclosing template class. Otherwise allow.
|
|
191
|
+
return !isCppDependentBaseMember(callerScope, candidate, scopes);
|
|
192
|
+
},
|
|
193
|
+
// C++ argument-dependent / Koenig lookup (U2 of plan 2026-05-13-001).
|
|
194
|
+
// Contributes candidates from associated namespaces of class-typed
|
|
195
|
+
// arguments; caller merges with ordinary unqualified lookup candidates.
|
|
196
|
+
// Current boundary: class-typed value/pointer/reference args and template
|
|
197
|
+
// specializations with explicit type arguments contribute associated
|
|
198
|
+
// namespaces. Function-pointer args and full conversion-ranking remain
|
|
199
|
+
// excluded.
|
|
200
|
+
resolveAdlCandidates: (site, callerParsed, scopes, parsedFiles) => {
|
|
201
|
+
// `using ns::name;` introduces `name` into ordinary unqualified lookup.
|
|
202
|
+
// For template-class method bodies, lexical scope walks can miss this
|
|
203
|
+
// named-using visibility; recover by resolving the imported namespace
|
|
204
|
+
// member directly when the local call name matches a named using import.
|
|
205
|
+
const usingNamedHits = [];
|
|
206
|
+
const seenUsing = new Set();
|
|
207
|
+
for (const imp of callerParsed.parsedImports) {
|
|
208
|
+
if (imp.kind !== 'named')
|
|
209
|
+
continue;
|
|
210
|
+
if (imp.localName !== site.name)
|
|
211
|
+
continue;
|
|
212
|
+
const member = resolveCppQualifiedNamespaceMember(imp.targetRaw, imp.importedName, parsedFiles, scopes);
|
|
213
|
+
if (member === undefined || member === 'ambiguous')
|
|
214
|
+
continue;
|
|
215
|
+
if (seenUsing.has(member.nodeId))
|
|
216
|
+
continue;
|
|
217
|
+
seenUsing.add(member.nodeId);
|
|
218
|
+
usingNamedHits.push(member);
|
|
219
|
+
}
|
|
220
|
+
const adlHits = pickCppAdlCandidates(site, callerParsed, scopes, parsedFiles);
|
|
221
|
+
if (usingNamedHits.length === 0)
|
|
222
|
+
return adlHits;
|
|
223
|
+
if (adlHits === undefined || adlHits.length === 0)
|
|
224
|
+
return usingNamedHits;
|
|
225
|
+
const merged = [];
|
|
226
|
+
const seen = new Set();
|
|
227
|
+
for (const hit of usingNamedHits) {
|
|
228
|
+
seen.add(hit.nodeId);
|
|
229
|
+
merged.push(hit);
|
|
230
|
+
}
|
|
231
|
+
for (const hit of adlHits) {
|
|
232
|
+
if (seen.has(hit.nodeId))
|
|
233
|
+
continue;
|
|
234
|
+
seen.add(hit.nodeId);
|
|
235
|
+
merged.push(hit);
|
|
236
|
+
}
|
|
237
|
+
return merged;
|
|
238
|
+
},
|
|
239
|
+
// C++ qualified namespace-member resolution (U5 of plan 2026-05-13-001).
|
|
240
|
+
// Handles `outer::foo()` where `outer` is a namespace (not a class).
|
|
241
|
+
// Walks each parsed file's namespace scopes by simple name, then
|
|
242
|
+
// descends transitively through inline-namespace children when
|
|
243
|
+
// searching for the called member. Returns undefined for non-namespace
|
|
244
|
+
// receivers so receiver-bound-calls Case 2 still gets a chance.
|
|
245
|
+
resolveQualifiedReceiverMember: (receiverName, memberName, _callerScope, scopes, parsedFiles) => resolveCppQualifiedNamespaceMember(receiverName, memberName, parsedFiles, scopes),
|
|
246
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CaptureMatch, ParsedImport, Scope, ScopeId, ScopeTree, TypeRef } from '../../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* C++ binding scope: default auto-hoist (null) for most declarations.
|
|
4
|
+
*
|
|
5
|
+
* For `for` statement init-scope variables (e.g. `for (int i = 0; ...)`),
|
|
6
|
+
* the variable is scoped to the for-block, not the enclosing function.
|
|
7
|
+
* The tree-sitter scope query already captures for_statement as @scope.block,
|
|
8
|
+
* so tree-sitter's scope nesting handles this automatically — we return null
|
|
9
|
+
* to let the default auto-hoist apply.
|
|
10
|
+
*/
|
|
11
|
+
export declare function cppBindingScopeFor(decl: CaptureMatch, innermost: Scope, tree: ScopeTree): ScopeId | null;
|
|
12
|
+
/**
|
|
13
|
+
* C++ import owning scope: default (null).
|
|
14
|
+
* #include and using declarations are file-scoped in C++.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cppImportOwningScope(_imp: ParsedImport, _innermost: Scope, _tree: ScopeTree): ScopeId | null;
|
|
17
|
+
/**
|
|
18
|
+
* C++ receiver binding: return `this` TypeRef for methods inside a class.
|
|
19
|
+
*
|
|
20
|
+
* When a function scope is inside a class scope, the implicit `this` pointer
|
|
21
|
+
* refers to the enclosing class. This enables `this->method()` and implicit
|
|
22
|
+
* `this` member access resolution.
|
|
23
|
+
*/
|
|
24
|
+
export declare function cppReceiverBinding(functionScope: Scope): TypeRef | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C++ binding scope: default auto-hoist (null) for most declarations.
|
|
3
|
+
*
|
|
4
|
+
* For `for` statement init-scope variables (e.g. `for (int i = 0; ...)`),
|
|
5
|
+
* the variable is scoped to the for-block, not the enclosing function.
|
|
6
|
+
* The tree-sitter scope query already captures for_statement as @scope.block,
|
|
7
|
+
* so tree-sitter's scope nesting handles this automatically — we return null
|
|
8
|
+
* to let the default auto-hoist apply.
|
|
9
|
+
*/
|
|
10
|
+
export function cppBindingScopeFor(decl, innermost, tree) {
|
|
11
|
+
// Hoist return-type bindings to Module scope so:
|
|
12
|
+
// 1. propagateImportedReturnTypes can mirror them across files
|
|
13
|
+
// 2. compound-receiver can find method return types via hoistTypeBindingsToModule
|
|
14
|
+
if (decl['@type-binding.return'] !== undefined) {
|
|
15
|
+
let cur = innermost;
|
|
16
|
+
while (cur !== undefined && cur.kind !== 'Module') {
|
|
17
|
+
const parentId = cur.parent ?? null;
|
|
18
|
+
if (parentId === null)
|
|
19
|
+
break;
|
|
20
|
+
cur = tree.getScope(parentId);
|
|
21
|
+
}
|
|
22
|
+
if (cur !== undefined && cur.kind === 'Module')
|
|
23
|
+
return cur.id;
|
|
24
|
+
}
|
|
25
|
+
return null; // default auto-hoist for other bindings
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* C++ import owning scope: default (null).
|
|
29
|
+
* #include and using declarations are file-scoped in C++.
|
|
30
|
+
*/
|
|
31
|
+
export function cppImportOwningScope(_imp, _innermost, _tree) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* C++ receiver binding: return `this` TypeRef for methods inside a class.
|
|
36
|
+
*
|
|
37
|
+
* When a function scope is inside a class scope, the implicit `this` pointer
|
|
38
|
+
* refers to the enclosing class. This enables `this->method()` and implicit
|
|
39
|
+
* `this` member access resolution.
|
|
40
|
+
*/
|
|
41
|
+
export function cppReceiverBinding(functionScope) {
|
|
42
|
+
// Walk up the scope tree to find an enclosing class scope
|
|
43
|
+
if (functionScope.parent === null)
|
|
44
|
+
return null;
|
|
45
|
+
// The scope tree structure nests function scopes inside class scopes.
|
|
46
|
+
// The orchestrator provides the function scope; we need to check if
|
|
47
|
+
// its parent chain contains a class scope.
|
|
48
|
+
//
|
|
49
|
+
// However, the ScopeResolver.receiverBinding contract receives only
|
|
50
|
+
// the function Scope (not the full ScopeTree), and the Scope type
|
|
51
|
+
// includes `parent` (a ScopeId) but not a reference to the parent
|
|
52
|
+
// Scope object.
|
|
53
|
+
//
|
|
54
|
+
// The orchestrator already handles this by looking up the class owner
|
|
55
|
+
// via populateOwners. We return null here and let the shared infra
|
|
56
|
+
// handle receiver resolution through the class-ownership mechanism.
|
|
57
|
+
//
|
|
58
|
+
// This is consistent with how C# and Go handle it — the receiver
|
|
59
|
+
// binding is established through populateOwners + the MRO chain,
|
|
60
|
+
// not through this hook.
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C++ two-phase template lookup support.
|
|
3
|
+
*
|
|
4
|
+
* Inside a class template body, names from a dependent base class are NOT
|
|
5
|
+
* found by ordinary unqualified lookup. The standard requires the
|
|
6
|
+
* `this->name` or `Base<T>::name` forms to make the lookup dependent.
|
|
7
|
+
* GitNexus's global free-call fallback otherwise binds such names to the
|
|
8
|
+
* dependent base's members, producing CALLS edges the compiler would
|
|
9
|
+
* reject.
|
|
10
|
+
*
|
|
11
|
+
* This module records — during `emitCppScopeCaptures` — which template
|
|
12
|
+
* class declarations have which dependent base class names (per file).
|
|
13
|
+
* `populateCppDependentBases` then resolves those names to class nodeIds
|
|
14
|
+
* using a workspace-wide registry, building the per-class set the
|
|
15
|
+
* `isCppDependentBaseMember` predicate consumes.
|
|
16
|
+
*
|
|
17
|
+
* Cross-file resolution: `Base<T>` may be declared in a different header
|
|
18
|
+
* than `Derived<T>`. `populateCppDependentBases` therefore runs as a
|
|
19
|
+
* workspace-wide pass (`populateWorkspaceOwners` hook) after every file
|
|
20
|
+
* has had `populateOwners` applied, so all class defs are reachable.
|
|
21
|
+
*
|
|
22
|
+
* Namespace disambiguation: when multiple classes share a simple name
|
|
23
|
+
* (e.g., `Box` in two namespaces), the resolver prefers the candidate
|
|
24
|
+
* whose qualified-name prefix (namespace path) matches the deriving
|
|
25
|
+
* class's prefix. If no namespace match is found, a unique simple-name
|
|
26
|
+
* match is accepted; ambiguous matches (multiple candidates, no
|
|
27
|
+
* namespace winner) are skipped conservatively.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: module-level state, single-process-single-repo use only.
|
|
30
|
+
* `clearFileLocalNames()` clears this state alongside file-local linkage
|
|
31
|
+
* (see `file-local-linkage.ts`).
|
|
32
|
+
*/
|
|
33
|
+
import type { ParsedFile, ScopeId, SymbolDefinition } from '../../../../_shared/index.js';
|
|
34
|
+
import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
|
|
35
|
+
/**
|
|
36
|
+
* Record a dependent-base relationship discovered during scope-capture
|
|
37
|
+
* emission. `className` is the simple name of the template class;
|
|
38
|
+
* `baseName` is the simple name of the dependent base class.
|
|
39
|
+
*
|
|
40
|
+
* The capture-time recorder uses simple names because the registry
|
|
41
|
+
* resolution that maps names → nodeIds runs later (in
|
|
42
|
+
* `populateCppDependentBases`).
|
|
43
|
+
*/
|
|
44
|
+
export declare function markCppDependentBase(filePath: string, className: string, baseName: string): void;
|
|
45
|
+
/** Clear two-phase-lookup state. Called from `clearFileLocalNames`. */
|
|
46
|
+
export declare function clearCppDependentBases(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve recorded dependent-base simple names to class nodeIds using a
|
|
49
|
+
* workspace-wide index. Run as `populateWorkspaceOwners` after every
|
|
50
|
+
* file has had `populateOwners` applied, so class defs from ALL files
|
|
51
|
+
* are reachable.
|
|
52
|
+
*
|
|
53
|
+
* Disambiguation strategy (multiple classes sharing a simple name):
|
|
54
|
+
* 1. Prefer the candidate whose qualified-name namespace prefix matches
|
|
55
|
+
* the deriving class's namespace prefix (same-namespace bias).
|
|
56
|
+
* 2. Fall back to accepting a unique simple-name match.
|
|
57
|
+
* 3. Skip when multiple candidates exist and no namespace match is
|
|
58
|
+
* found (conservative: avoids false associations).
|
|
59
|
+
*/
|
|
60
|
+
export declare function populateCppDependentBases(parsedFiles: readonly ParsedFile[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Two-phase lookup predicate: is the candidate def a member of a
|
|
63
|
+
* dependent base of the caller's enclosing template class?
|
|
64
|
+
*
|
|
65
|
+
* Used as an additional reject-filter in `pickUniqueGlobalCallable` and
|
|
66
|
+
* the receiver-bound member chain walk. ONLY apply for unqualified
|
|
67
|
+
* call forms — `this->name` and `Base<T>::name` are dependent lookup
|
|
68
|
+
* forms that the standard allows.
|
|
69
|
+
*
|
|
70
|
+
* Conservative bias: when the caller's enclosing class can't be
|
|
71
|
+
* identified, return `false` (let normal resolution proceed). Over-
|
|
72
|
+
* rejection is acceptable for the template case because the standard
|
|
73
|
+
* itself requires `this->` or qualified forms for dependent base
|
|
74
|
+
* access; missing edges here match the compiler's diagnostic shape.
|
|
75
|
+
*/
|
|
76
|
+
export declare function isCppDependentBaseMember(callerScopeId: ScopeId, candidateDef: SymbolDefinition, scopes: ScopeResolutionIndexes): boolean;
|