gitnexus 1.6.5-rc.2 → 1.6.5-rc.21
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/README.md +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/cli/ai-context.d.ts +1 -0
- package/dist/cli/ai-context.js +30 -12
- package/dist/cli/analyze.d.ts +18 -0
- package/dist/cli/analyze.js +33 -4
- package/dist/cli/augment.d.ts +1 -1
- package/dist/cli/augment.js +1 -1
- package/dist/cli/index.js +6 -1
- package/dist/cli/setup.js +6 -0
- package/dist/core/augmentation/engine.d.ts +2 -2
- package/dist/core/augmentation/engine.js +26 -6
- package/dist/core/embeddings/ast-utils.js +2 -1
- package/dist/core/embeddings/http-client.js +22 -6
- package/dist/core/group/extractors/grpc-extractor.js +2 -1
- package/dist/core/group/extractors/http-patterns/python.js +175 -0
- package/dist/core/group/extractors/http-route-extractor.js +2 -1
- package/dist/core/group/extractors/include-extractor.js +2 -1
- package/dist/core/group/extractors/thrift-extractor.js +2 -1
- package/dist/core/group/extractors/tree-sitter-scanner.js +2 -1
- 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.js +166 -47
- package/dist/core/ingestion/community-processor.js +18 -0
- package/dist/core/ingestion/heritage-processor.js +3 -2
- package/dist/core/ingestion/import-processor.js +2 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +5 -0
- package/dist/core/ingestion/import-resolvers/standard.js +27 -1
- package/dist/core/ingestion/import-resolvers/utils.js +4 -0
- package/dist/core/ingestion/languages/c/arity-metadata.d.ts +14 -0
- package/dist/core/ingestion/languages/c/arity-metadata.js +94 -0
- package/dist/core/ingestion/languages/c/arity.d.ts +6 -0
- package/dist/core/ingestion/languages/c/arity.js +18 -0
- package/dist/core/ingestion/languages/c/captures.d.ts +2 -0
- package/dist/core/ingestion/languages/c/captures.js +105 -0
- package/dist/core/ingestion/languages/c/header-scan.d.ts +7 -0
- package/dist/core/ingestion/languages/c/header-scan.js +55 -0
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +8 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +50 -0
- package/dist/core/ingestion/languages/c/import-target.d.ts +14 -0
- package/dist/core/ingestion/languages/c/import-target.js +57 -0
- package/dist/core/ingestion/languages/c/index.d.ts +11 -0
- package/dist/core/ingestion/languages/c/index.js +11 -0
- package/dist/core/ingestion/languages/c/interpret.d.ts +14 -0
- package/dist/core/ingestion/languages/c/interpret.js +48 -0
- package/dist/core/ingestion/languages/c/merge-bindings.d.ts +7 -0
- package/dist/core/ingestion/languages/c/merge-bindings.js +23 -0
- package/dist/core/ingestion/languages/c/query.d.ts +3 -0
- package/dist/core/ingestion/languages/c/query.js +161 -0
- package/dist/core/ingestion/languages/c/scope-resolver.d.ts +13 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +60 -0
- package/dist/core/ingestion/languages/c/simple-hooks.d.ts +14 -0
- package/dist/core/ingestion/languages/c/simple-hooks.js +19 -0
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +13 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +57 -0
- package/dist/core/ingestion/languages/c-cpp.js +10 -0
- package/dist/core/ingestion/languages/csharp/captures.js +2 -1
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +3 -2
- package/dist/core/ingestion/languages/go/captures.js +2 -1
- package/dist/core/ingestion/languages/go/range-binding.js +2 -1
- 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/languages/python/captures.js +2 -1
- package/dist/core/ingestion/languages/typescript/captures.js +2 -1
- package/dist/core/ingestion/parsing-processor.d.ts +22 -2
- package/dist/core/ingestion/parsing-processor.js +85 -50
- 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-resolution/contract/scope-resolver.d.ts +65 -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 +5 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +25 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +79 -7
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +7 -3
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +24 -4
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +21 -2
- 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 +31 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -1
- package/dist/core/ingestion/tree-sitter-queries.js +10 -0
- package/dist/core/ingestion/workers/parse-worker.js +2 -1
- package/dist/core/lbug/lbug-adapter.d.ts +26 -0
- package/dist/core/lbug/lbug-adapter.js +174 -40
- package/dist/core/lbug/pool-adapter.js +19 -2
- package/dist/core/run-analyze.d.ts +2 -0
- package/dist/core/run-analyze.js +323 -29
- package/dist/core/tree-sitter/safe-parse.d.ts +6 -0
- package/dist/core/tree-sitter/safe-parse.js +32 -0
- package/dist/server/git-clone.js +10 -13
- package/dist/storage/file-hash.d.ts +47 -0
- package/dist/storage/file-hash.js +86 -0
- package/dist/storage/git.d.ts +17 -6
- package/dist/storage/git.js +46 -12
- package/dist/storage/parse-cache.d.ts +67 -0
- package/dist/storage/parse-cache.js +182 -0
- package/dist/storage/repo-manager.d.ts +41 -1
- package/dist/storage/repo-manager.js +17 -2
- package/hooks/claude/gitnexus-hook.cjs +8 -1
- package/hooks/claude/hook-lock.cjs +119 -0
- package/package.json +1 -1
- package/web/assets/{agent-BpHQleHE.js → agent-BG6RCOzz.js} +1 -1
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-F-tujre-.js +1 -0
- package/web/assets/architectureDiagram-UL44E2DR-2GL7nOvO.js +36 -0
- package/web/assets/blockDiagram-7IZFK4PR-5AjX0pPU.js +132 -0
- package/web/assets/{c4Diagram-DFAF54RM-DeJV1rCn.js → c4Diagram-Y2BXMSZH-hLOeq7xC.js} +2 -2
- package/web/assets/chunk-2T2R6R2M-B_pq_2nf.js +4 -0
- package/web/assets/chunk-2UTLFMKG-CpoohCFN.js +1 -0
- package/web/assets/{chunk-7RZVMHOQ-BdIU-RGO.js → chunk-3SSMPTDK-CfqpR3Nr.js} +1 -1
- package/web/assets/chunk-4R4BOZG6-D3gm7tYj.js +159 -0
- package/web/assets/chunk-6764PJDD-WcI965eO.js +1 -0
- package/web/assets/chunk-AQ6EADP3-BpMj3rQl.js +1 -0
- package/web/assets/{chunk-KSICW3F5-C2tZmXwv.js → chunk-AZZRMDJM-DSoCJlUA.js} +1 -1
- package/web/assets/chunk-C62D2QBJ-CvFF2PnB.js +1 -0
- package/web/assets/chunk-CEXFNPSA-DdNtJtrF.js +1 -0
- package/web/assets/chunk-J5EP6P6S-DtcVaAJI.js +1 -0
- package/web/assets/{chunk-AEOMTBSW-D7qjBMHW.js → chunk-JQRUD6KW-DElaNjc0.js} +1 -1
- package/web/assets/chunk-KGYTTC2M-D0K5or7e.js +1 -0
- package/web/assets/chunk-KRXBNO2N-DpR8iDt8.js +1 -0
- package/web/assets/chunk-LCXTWHL2-DdMObOEk.js +231 -0
- package/web/assets/chunk-LII3EMHJ-I78zXtzi.js +1 -0
- package/web/assets/chunk-RERM46MO-Betu1cSy.js +1 -0
- package/web/assets/chunk-RG4AUYOV-BUCJ2JP5.js +206 -0
- package/web/assets/chunk-RKZBBQEN-Cutpza0t.js +1 -0
- package/web/assets/chunk-RLI5ZMPA-BFUxCvX2.js +1 -0
- package/web/assets/chunk-T5OCTHI4-DKwlkuvB.js +1 -0
- package/web/assets/chunk-UP6H54XL-0YWa0NDg.js +1 -0
- package/web/assets/chunk-UXSXWOXI-CSz0OXpz.js +1 -0
- package/web/assets/chunk-W44A43WB-AOmgoT-X.js +1 -0
- package/web/assets/{chunk-RWUO3TPN-DTWzAhQ1.js → chunk-ZXARS5L4-DIzgxjMw.js} +1 -1
- package/web/assets/classDiagram-KGZ6W3CR-BT-rn7LF.js +1 -0
- package/web/assets/classDiagram-v2-72OJOZXJ-uR3nDadY.js +1 -0
- package/web/assets/{cose-bilkent-PNC4W37J-DdZq7Qz_.js → cose-bilkent-UX7MHV2Q-DCSCD1TK.js} +1 -1
- package/web/assets/dagre-ND4H6XIP-CsciHSij.js +4 -0
- package/web/assets/diagram-3NCE3AQN-BKUT5Rpc.js +43 -0
- package/web/assets/diagram-GF46GFSD-Dxb4hZSo.js +24 -0
- package/web/assets/diagram-HNR7UZ2L-D3qus9Cn.js +3 -0
- package/web/assets/diagram-QXG6HAR7-r9BMLGGP.js +24 -0
- package/web/assets/diagram-WEQXMOUZ-BGXqs7-m.js +10 -0
- package/web/assets/{erDiagram-GCSMX5X6-DfdN6iqF.js → erDiagram-L5TCEMPS-LgSWVrkZ.js} +2 -2
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-By7r3bla.js +1 -0
- package/web/assets/flowDiagram-H6V6AXG4-Bj_vV5ky.js +162 -0
- package/web/assets/ganttDiagram-JCBTUEKG-B1eVITSh.js +292 -0
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-ClEP6RdE.js +1 -0
- package/web/assets/gitGraphDiagram-S2ZK5IYY-BP0R-_FD.js +106 -0
- package/web/assets/{index-3NUCUW2s.js → index-oL-ZNYwb.js} +80 -81
- package/web/assets/info-J43DQDTF-KCYPFFUO-bBJRjmP5.js +1 -0
- package/web/assets/infoDiagram-3YFTVSEB-Dmj4OEO3.js +2 -0
- package/web/assets/{ishikawaDiagram-YMYX4NHK-BF8AtDaj.js → ishikawaDiagram-BNXS4ZKH-B3NgQ4lJ.js} +2 -2
- package/web/assets/{journeyDiagram-SO5T7YLQ-BW8oKa3N.js → journeyDiagram-M6C3CM3L-DALmL4_N.js} +3 -3
- package/web/assets/{kanban-definition-LJHFXRCJ-DzbOsR-2.js → kanban-definition-75IXJCU3-AvVbHpnN.js} +4 -4
- package/web/assets/{katex-GD7MH7QM-CJiOjBBJ.js → katex-K3KEBU37-CqF6_ZN-.js} +1 -1
- package/web/assets/{mindmap-definition-2EUWGEK5-BIXGQALq.js → mindmap-definition-2TDM6QVE-B5c9VOzs.js} +28 -28
- package/web/assets/packet-YPE3B663-LP52Z2RK-1ZCldnu3.js +1 -0
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-EhjHC5EE.js +1 -0
- package/web/assets/pieDiagram-CU6KROY3-Po2HSSR4.js +30 -0
- package/web/assets/quadrantDiagram-VICAPDV7-C47UxSZD.js +7 -0
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-CvXjgxlW.js +1 -0
- package/web/assets/{requirementDiagram-M5DCFWZL-CzUUrhQD.js → requirementDiagram-JXO7QTGE-CpECN_Hq.js} +6 -6
- package/web/assets/sankeyDiagram-URQDO5SZ-B3b7cLrS.js +40 -0
- package/web/assets/sequenceDiagram-VS2MUI6T-CRJ95oVP.js +162 -0
- package/web/assets/stateDiagram-7D4R322I-C7U9b3ks.js +1 -0
- package/web/assets/stateDiagram-v2-36443NZ5-BQajbtov.js +1 -0
- package/web/assets/{timeline-definition-5SPVSISX-DkMiGj4Z.js → timeline-definition-O6YCAMPW-rtbk6BBo.js} +4 -4
- package/web/assets/treeView-BLDUP644-QA4HXRO3-R2o5gwfP.js +1 -0
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-Cesmac_u.js +1 -0
- package/web/assets/{vennDiagram-IE5QUKF5-BCxMmf9q.js → vennDiagram-MWXL3ELB-W8Yoaayh.js} +3 -3
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-B9HYoRgA.js +1 -0
- package/web/assets/wardleyDiagram-CUQ6CDDI-DIZw5Abj.js +78 -0
- package/web/assets/{xychartDiagram-ZHJ5623Y-DZ7fP1_3.js → xychartDiagram-N2JHSOCM-DGRtrj4P.js} +3 -3
- package/web/index.html +2 -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-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/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/flowDiagram-OTCZ4VVT-aAZw4c_M.js +0 -162
- 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/info-OMHHGYJF-BF2H5H6G-BIOsZy0W.js +0 -1
- package/web/assets/infoDiagram-MN7RKWGX-DUoMH-pq.js +0 -2
- 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/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/treeView-SZITEDCU-5DXDK3XO-Cy6P0_CZ.js +0 -1
- package/web/assets/treemap-W4RFUUIX-WYLRDWKO-C_pp1R7A.js +0 -1
- 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-CG-ydtp4.js} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesize `@type-binding.self` captures for Java instance methods —
|
|
3
|
+
* one for `this` (always on non-static methods inside a type
|
|
4
|
+
* declaration) and optionally one for `super` (only on class methods
|
|
5
|
+
* when the enclosing class has a `superclass`).
|
|
6
|
+
*
|
|
7
|
+
* Mirrors `languages/csharp/receiver-binding.ts` in structure.
|
|
8
|
+
*/
|
|
9
|
+
import { nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
10
|
+
const TYPE_DECL_NODE_TYPES = new Set([
|
|
11
|
+
'class_declaration',
|
|
12
|
+
'interface_declaration',
|
|
13
|
+
'enum_declaration',
|
|
14
|
+
'record_declaration',
|
|
15
|
+
]);
|
|
16
|
+
const FUNCTION_NODE_TYPES = new Set(['method_declaration', 'constructor_declaration']);
|
|
17
|
+
/** Walk up to the enclosing type declaration. */
|
|
18
|
+
function findEnclosingTypeDeclaration(node) {
|
|
19
|
+
let cur = node.parent;
|
|
20
|
+
while (cur !== null) {
|
|
21
|
+
if (TYPE_DECL_NODE_TYPES.has(cur.type))
|
|
22
|
+
return cur;
|
|
23
|
+
cur = cur.parent;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function typeName(typeNode) {
|
|
28
|
+
return typeNode.childForFieldName('name')?.text ?? null;
|
|
29
|
+
}
|
|
30
|
+
/** First superclass text. tree-sitter-java uses a `superclass` field
|
|
31
|
+
* containing a `superclass` node wrapping a `type_identifier`. */
|
|
32
|
+
function firstSuperclassText(typeNode) {
|
|
33
|
+
const superclass = typeNode.childForFieldName('superclass');
|
|
34
|
+
if (superclass === null)
|
|
35
|
+
return null;
|
|
36
|
+
// The superclass node wraps the type_identifier
|
|
37
|
+
for (let i = 0; i < superclass.namedChildCount; i++) {
|
|
38
|
+
const child = superclass.namedChild(i);
|
|
39
|
+
if (child !== null && (child.type === 'type_identifier' || child.type === 'generic_type')) {
|
|
40
|
+
return child.text;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/** Check if a method has the `static` modifier. In tree-sitter-java,
|
|
46
|
+
* modifiers are grouped under a `modifiers` named child with anonymous
|
|
47
|
+
* keyword tokens. */
|
|
48
|
+
function isStaticMethod(fnNode) {
|
|
49
|
+
for (let i = 0; i < fnNode.namedChildCount; i++) {
|
|
50
|
+
const child = fnNode.namedChild(i);
|
|
51
|
+
if (child !== null && child.type === 'modifiers') {
|
|
52
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
53
|
+
const mod = child.child(j);
|
|
54
|
+
if (mod !== null && mod.text.trim() === 'static')
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
export function synthesizeJavaReceiverBinding(fnNode) {
|
|
62
|
+
if (!FUNCTION_NODE_TYPES.has(fnNode.type))
|
|
63
|
+
return [];
|
|
64
|
+
if (isStaticMethod(fnNode))
|
|
65
|
+
return [];
|
|
66
|
+
const enclosingType = findEnclosingTypeDeclaration(fnNode);
|
|
67
|
+
if (enclosingType === null)
|
|
68
|
+
return [];
|
|
69
|
+
const enclosingName = typeName(enclosingType);
|
|
70
|
+
if (enclosingName === null)
|
|
71
|
+
return [];
|
|
72
|
+
// Anchor to the method body so the synthesized captures are inside
|
|
73
|
+
// the function scope.
|
|
74
|
+
const anchorNode = fnNode.childForFieldName('body');
|
|
75
|
+
if (anchorNode === null)
|
|
76
|
+
return [];
|
|
77
|
+
const out = [];
|
|
78
|
+
out.push(buildReceiverMatch(anchorNode, 'this', enclosingName));
|
|
79
|
+
// `super` applies only to class/record methods with an explicit superclass.
|
|
80
|
+
if (enclosingType.type === 'class_declaration' || enclosingType.type === 'record_declaration') {
|
|
81
|
+
const superText = firstSuperclassText(enclosingType);
|
|
82
|
+
if (superText !== null) {
|
|
83
|
+
out.push(buildReceiverMatch(anchorNode, 'super', superText));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
function buildReceiverMatch(anchorNode, name, typeText) {
|
|
89
|
+
const m = {
|
|
90
|
+
'@type-binding.self': nodeToCapture('@type-binding.self', anchorNode),
|
|
91
|
+
'@type-binding.name': syntheticCapture('@type-binding.name', anchorNode, name),
|
|
92
|
+
'@type-binding.type': syntheticCapture('@type-binding.type', anchorNode, typeText),
|
|
93
|
+
};
|
|
94
|
+
return m;
|
|
95
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
3
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
4
|
+
*
|
|
5
|
+
* ## Registry-primary parity status
|
|
6
|
+
*
|
|
7
|
+
* Java is **not** in `MIGRATED_LANGUAGES` — the scope-resolution
|
|
8
|
+
* registry runs in shadow mode only. Parity in forced registry mode
|
|
9
|
+
* (`REGISTRY_PRIMARY_JAVA=1`) is 143/172 (83%). The 29 gaps fall into:
|
|
10
|
+
*
|
|
11
|
+
* - switch pattern binding / sealed-class exhaustiveness
|
|
12
|
+
* - Map.values() / entrySet() iteration type propagation
|
|
13
|
+
* - assignment / method chain return-type propagation across files
|
|
14
|
+
* - virtual dispatch / interface default methods
|
|
15
|
+
*
|
|
16
|
+
* These are the same category of advanced-resolution gaps seen in prior
|
|
17
|
+
* migrations (Python, C#, Go). Parity is below the ≥99% flip threshold
|
|
18
|
+
* per RFC §6.4.
|
|
19
|
+
*
|
|
20
|
+
* **CI visibility:** Because Java is absent from `MIGRATED_LANGUAGES`,
|
|
21
|
+
* the parity CI workflow (`ci-scope-parity.yml`) does not run Java in
|
|
22
|
+
* either `REGISTRY_PRIMARY_JAVA=0` or `=1` mode. Regressions in forced
|
|
23
|
+
* mode are only visible via manual `REGISTRY_PRIMARY_JAVA=1 npx vitest
|
|
24
|
+
* run java.test.ts`. Before flipping Java to registry-primary, a
|
|
25
|
+
* non-required CI step should be added to run Java tests in forced mode
|
|
26
|
+
* and report parity as a dashboard input.
|
|
27
|
+
*
|
|
28
|
+
* **Parity baseline (29 failures):** The 29 gaps in forced registry mode
|
|
29
|
+
* are tracked in this PR (#1482) and this JSDoc. If the gap count
|
|
30
|
+
* changes (up or down), update this baseline accordingly.
|
|
31
|
+
*
|
|
32
|
+
* ### Known flip-blockers (must fix before adding to MIGRATED_LANGUAGES)
|
|
33
|
+
*
|
|
34
|
+
* - Varargs arity: fixed-prefix count is now preserved, but no
|
|
35
|
+
* integration fixture exercises the 0-arg rejection path yet.
|
|
36
|
+
* - Static import resolution: `import static X.Y.m` now correctly
|
|
37
|
+
* resolves to `X/Y.java` (the class), not `X/Y/m.java` (the member).
|
|
38
|
+
* Edge cases with nested classes may remain.
|
|
39
|
+
* - Generic superclass receiver binding: `BaseModel<T>` now strips
|
|
40
|
+
* to `BaseModel` via JVM type-erasure fallback in `stripGeneric`.
|
|
41
|
+
* - Wildcard import (`import com.example.*`) file selection is
|
|
42
|
+
* nondeterministic when multiple classes share a package directory.
|
|
43
|
+
* May produce wrong-file edges in forced mode.
|
|
44
|
+
* - Qualified generic type parameters in field/parameter annotations
|
|
45
|
+
* (`com.example.BaseModel<T>`) — rare in practice but may miss
|
|
46
|
+
* resolution when the full qualifier is present with generics.
|
|
47
|
+
*/
|
|
48
|
+
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
|
49
|
+
declare const javaScopeResolver: ScopeResolver;
|
|
50
|
+
export { javaScopeResolver };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
3
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
4
|
+
*
|
|
5
|
+
* ## Registry-primary parity status
|
|
6
|
+
*
|
|
7
|
+
* Java is **not** in `MIGRATED_LANGUAGES` — the scope-resolution
|
|
8
|
+
* registry runs in shadow mode only. Parity in forced registry mode
|
|
9
|
+
* (`REGISTRY_PRIMARY_JAVA=1`) is 143/172 (83%). The 29 gaps fall into:
|
|
10
|
+
*
|
|
11
|
+
* - switch pattern binding / sealed-class exhaustiveness
|
|
12
|
+
* - Map.values() / entrySet() iteration type propagation
|
|
13
|
+
* - assignment / method chain return-type propagation across files
|
|
14
|
+
* - virtual dispatch / interface default methods
|
|
15
|
+
*
|
|
16
|
+
* These are the same category of advanced-resolution gaps seen in prior
|
|
17
|
+
* migrations (Python, C#, Go). Parity is below the ≥99% flip threshold
|
|
18
|
+
* per RFC §6.4.
|
|
19
|
+
*
|
|
20
|
+
* **CI visibility:** Because Java is absent from `MIGRATED_LANGUAGES`,
|
|
21
|
+
* the parity CI workflow (`ci-scope-parity.yml`) does not run Java in
|
|
22
|
+
* either `REGISTRY_PRIMARY_JAVA=0` or `=1` mode. Regressions in forced
|
|
23
|
+
* mode are only visible via manual `REGISTRY_PRIMARY_JAVA=1 npx vitest
|
|
24
|
+
* run java.test.ts`. Before flipping Java to registry-primary, a
|
|
25
|
+
* non-required CI step should be added to run Java tests in forced mode
|
|
26
|
+
* and report parity as a dashboard input.
|
|
27
|
+
*
|
|
28
|
+
* **Parity baseline (29 failures):** The 29 gaps in forced registry mode
|
|
29
|
+
* are tracked in this PR (#1482) and this JSDoc. If the gap count
|
|
30
|
+
* changes (up or down), update this baseline accordingly.
|
|
31
|
+
*
|
|
32
|
+
* ### Known flip-blockers (must fix before adding to MIGRATED_LANGUAGES)
|
|
33
|
+
*
|
|
34
|
+
* - Varargs arity: fixed-prefix count is now preserved, but no
|
|
35
|
+
* integration fixture exercises the 0-arg rejection path yet.
|
|
36
|
+
* - Static import resolution: `import static X.Y.m` now correctly
|
|
37
|
+
* resolves to `X/Y.java` (the class), not `X/Y/m.java` (the member).
|
|
38
|
+
* Edge cases with nested classes may remain.
|
|
39
|
+
* - Generic superclass receiver binding: `BaseModel<T>` now strips
|
|
40
|
+
* to `BaseModel` via JVM type-erasure fallback in `stripGeneric`.
|
|
41
|
+
* - Wildcard import (`import com.example.*`) file selection is
|
|
42
|
+
* nondeterministic when multiple classes share a package directory.
|
|
43
|
+
* May produce wrong-file edges in forced mode.
|
|
44
|
+
* - Qualified generic type parameters in field/parameter annotations
|
|
45
|
+
* (`com.example.BaseModel<T>`) — rare in practice but may miss
|
|
46
|
+
* resolution when the full qualifier is present with generics.
|
|
47
|
+
*/
|
|
48
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
49
|
+
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
|
50
|
+
import { populateClassOwnedMembers } from '../../scope-resolution/scope/walkers.js';
|
|
51
|
+
import { javaProvider } from '../java.js';
|
|
52
|
+
import { javaArityCompatibility, javaMergeBindings, resolveJavaImportTarget, } from './index.js';
|
|
53
|
+
const javaScopeResolver = {
|
|
54
|
+
language: SupportedLanguages.Java,
|
|
55
|
+
languageProvider: javaProvider,
|
|
56
|
+
importEdgeReason: 'java-scope: import',
|
|
57
|
+
resolveImportTarget: (targetRaw, fromFile, allFilePaths) => {
|
|
58
|
+
const ws = { fromFile, allFilePaths };
|
|
59
|
+
return resolveJavaImportTarget({ kind: 'named', localName: '_', importedName: '_', targetRaw }, ws);
|
|
60
|
+
},
|
|
61
|
+
mergeBindings: (existing, incoming) => [...javaMergeBindings([...existing, ...incoming])],
|
|
62
|
+
arityCompatibility: (callsite, def) => javaArityCompatibility(def, callsite),
|
|
63
|
+
buildMro: (graph, parsedFiles, nodeLookup) => buildMro(graph, parsedFiles, nodeLookup, defaultLinearize),
|
|
64
|
+
populateOwners: (parsed) => populateClassOwnedMembers(parsed),
|
|
65
|
+
isSuperReceiver: (text) => text.trim() === 'super',
|
|
66
|
+
// Java is statically typed — field-fallback heuristic stays off
|
|
67
|
+
fieldFallbackOnMethodLookup: false,
|
|
68
|
+
propagatesReturnTypesAcrossImports: true,
|
|
69
|
+
// Java doesn't collapse member calls
|
|
70
|
+
collapseMemberCallsByCallerTarget: false,
|
|
71
|
+
// Hoist return-type bindings to Module scope for cross-file propagation
|
|
72
|
+
hoistTypeBindingsToModule: true,
|
|
73
|
+
};
|
|
74
|
+
export { javaScopeResolver };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small hooks for the Java provider. Each is a few lines; they make
|
|
3
|
+
* the provider's choice explicit rather than relying on defaults.
|
|
4
|
+
*/
|
|
5
|
+
import type { CaptureMatch, ParsedImport, Scope, ScopeId, ScopeTree, TypeRef } from '../../../../_shared/index.js';
|
|
6
|
+
/** Method return-type bindings hoist to Module scope so cross-file
|
|
7
|
+
* `propagateImportedReturnTypes` and chain-follow can find them. */
|
|
8
|
+
export declare function javaBindingScopeFor(decl: CaptureMatch, innermost: Scope, tree: ScopeTree): ScopeId | null;
|
|
9
|
+
/** Java imports are always at compilation-unit (Module) level (JLS §7.5).
|
|
10
|
+
* Return `null` unconditionally so the default Module scope is used. */
|
|
11
|
+
export declare function javaImportOwningScope(_imp: ParsedImport, _innermost: Scope, _tree: ScopeTree): ScopeId | null;
|
|
12
|
+
/** Look up `this` or `super` in the function scope's type bindings. */
|
|
13
|
+
export declare function javaReceiverBinding(functionScope: Scope): TypeRef | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small hooks for the Java provider. Each is a few lines; they make
|
|
3
|
+
* the provider's choice explicit rather than relying on defaults.
|
|
4
|
+
*/
|
|
5
|
+
// ─── bindingScopeFor ──────────────────────────────────────────────────────
|
|
6
|
+
/** Method return-type bindings hoist to Module scope so cross-file
|
|
7
|
+
* `propagateImportedReturnTypes` and chain-follow can find them. */
|
|
8
|
+
export function javaBindingScopeFor(decl, innermost, tree) {
|
|
9
|
+
if (decl['@type-binding.return'] !== undefined) {
|
|
10
|
+
let cur = innermost;
|
|
11
|
+
while (cur !== undefined && cur.kind !== 'Module') {
|
|
12
|
+
const parentId = cur.parent ?? null;
|
|
13
|
+
if (parentId === null)
|
|
14
|
+
break;
|
|
15
|
+
cur = tree.getScope(parentId);
|
|
16
|
+
}
|
|
17
|
+
if (cur !== undefined && cur.kind === 'Module')
|
|
18
|
+
return cur.id;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// ─── importOwningScope ────────────────────────────────────────────────────
|
|
23
|
+
/** Java imports are always at compilation-unit (Module) level (JLS §7.5).
|
|
24
|
+
* Return `null` unconditionally so the default Module scope is used. */
|
|
25
|
+
export function javaImportOwningScope(_imp, _innermost, _tree) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
// ─── receiverBinding ──────────────────────────────────────────────────────
|
|
29
|
+
/** Look up `this` or `super` in the function scope's type bindings. */
|
|
30
|
+
export function javaReceiverBinding(functionScope) {
|
|
31
|
+
if (functionScope.kind !== 'Function')
|
|
32
|
+
return null;
|
|
33
|
+
return functionScope.typeBindings.get('this') ?? functionScope.typeBindings.get('super') ?? null;
|
|
34
|
+
}
|
|
@@ -25,6 +25,7 @@ import { javaMethodConfig } from '../method-extractors/configs/jvm.js';
|
|
|
25
25
|
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
26
26
|
import { javaVariableConfig } from '../variable-extractors/configs/jvm.js';
|
|
27
27
|
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
28
|
+
import { emitJavaScopeCaptures, interpretJavaImport, interpretJavaTypeBinding, javaBindingScopeFor, javaImportOwningScope, javaMergeBindings, javaReceiverBinding, javaArityCompatibility, resolveJavaImportTarget, } from './java/index.js';
|
|
28
29
|
export const javaProvider = defineLanguage({
|
|
29
30
|
id: SupportedLanguages.Java,
|
|
30
31
|
extensions: ['.java'],
|
|
@@ -62,4 +63,14 @@ export const javaProvider = defineLanguage({
|
|
|
62
63
|
variableExtractor: createVariableExtractor(javaVariableConfig),
|
|
63
64
|
classExtractor: createClassExtractor(javaClassConfig),
|
|
64
65
|
heritageExtractor: createHeritageExtractor(SupportedLanguages.Java),
|
|
66
|
+
// ── RFC #909 Ring 3: scope-based resolution hooks ──
|
|
67
|
+
emitScopeCaptures: emitJavaScopeCaptures,
|
|
68
|
+
interpretImport: interpretJavaImport,
|
|
69
|
+
interpretTypeBinding: interpretJavaTypeBinding,
|
|
70
|
+
bindingScopeFor: javaBindingScopeFor,
|
|
71
|
+
importOwningScope: javaImportOwningScope,
|
|
72
|
+
mergeBindings: (_scope, bindings) => javaMergeBindings(bindings),
|
|
73
|
+
receiverBinding: javaReceiverBinding,
|
|
74
|
+
arityCompatibility: javaArityCompatibility,
|
|
75
|
+
resolveImportTarget: resolveJavaImportTarget,
|
|
65
76
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract PHP arity metadata from a method-like tree-sitter node —
|
|
3
|
+
* `method_declaration` or `function_definition`.
|
|
4
|
+
*
|
|
5
|
+
* Reuses `phpMethodConfig.extractParameters` so scope-extracted defs
|
|
6
|
+
* carry the same arity semantics as the legacy parse-worker path:
|
|
7
|
+
* - `variadic_parameter` (`...$args`) collapses `parameterCount` to
|
|
8
|
+
* `undefined`, which `phpArityCompatibility` then treats as
|
|
9
|
+
* "max unknown" — the candidate stays eligible at `argCount >= required`.
|
|
10
|
+
* - Defaulted parameters (`= expr`) contribute to `optionalCount`;
|
|
11
|
+
* `requiredParameterCount = total − optionalCount − (variadic ? 1 : 0)`.
|
|
12
|
+
* The variadic slot itself accepts zero args so it is subtracted from
|
|
13
|
+
* the required count — `f(int $a, ...$rest)` requires exactly 1 arg,
|
|
14
|
+
* not 2, and `f(...$rest)` requires 0.
|
|
15
|
+
* - `property_promotion_parameter` (constructor-promoted) is counted
|
|
16
|
+
* the same as `simple_parameter` since both consume an argument slot.
|
|
17
|
+
* - `parameterTypes` collects declared type names; a literal `'...'`
|
|
18
|
+
* marker is appended for variadic methods so `phpArityCompatibility`
|
|
19
|
+
* can detect them without re-reading the AST.
|
|
20
|
+
*/
|
|
21
|
+
import type { SyntaxNode } from '../../utils/ast-helpers.js';
|
|
22
|
+
interface PhpArityMetadata {
|
|
23
|
+
readonly parameterCount: number | undefined;
|
|
24
|
+
readonly requiredParameterCount: number | undefined;
|
|
25
|
+
readonly parameterTypes: readonly string[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function computePhpArityMetadata(fnNode: SyntaxNode): PhpArityMetadata;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract PHP arity metadata from a method-like tree-sitter node —
|
|
3
|
+
* `method_declaration` or `function_definition`.
|
|
4
|
+
*
|
|
5
|
+
* Reuses `phpMethodConfig.extractParameters` so scope-extracted defs
|
|
6
|
+
* carry the same arity semantics as the legacy parse-worker path:
|
|
7
|
+
* - `variadic_parameter` (`...$args`) collapses `parameterCount` to
|
|
8
|
+
* `undefined`, which `phpArityCompatibility` then treats as
|
|
9
|
+
* "max unknown" — the candidate stays eligible at `argCount >= required`.
|
|
10
|
+
* - Defaulted parameters (`= expr`) contribute to `optionalCount`;
|
|
11
|
+
* `requiredParameterCount = total − optionalCount − (variadic ? 1 : 0)`.
|
|
12
|
+
* The variadic slot itself accepts zero args so it is subtracted from
|
|
13
|
+
* the required count — `f(int $a, ...$rest)` requires exactly 1 arg,
|
|
14
|
+
* not 2, and `f(...$rest)` requires 0.
|
|
15
|
+
* - `property_promotion_parameter` (constructor-promoted) is counted
|
|
16
|
+
* the same as `simple_parameter` since both consume an argument slot.
|
|
17
|
+
* - `parameterTypes` collects declared type names; a literal `'...'`
|
|
18
|
+
* marker is appended for variadic methods so `phpArityCompatibility`
|
|
19
|
+
* can detect them without re-reading the AST.
|
|
20
|
+
*/
|
|
21
|
+
import { phpMethodConfig } from '../../method-extractors/configs/php.js';
|
|
22
|
+
export function computePhpArityMetadata(fnNode) {
|
|
23
|
+
const params = phpMethodConfig.extractParameters?.(fnNode) ?? [];
|
|
24
|
+
let hasVariadic = false;
|
|
25
|
+
let optionalCount = 0;
|
|
26
|
+
const types = [];
|
|
27
|
+
for (const p of params) {
|
|
28
|
+
if (p.isVariadic) {
|
|
29
|
+
hasVariadic = true;
|
|
30
|
+
}
|
|
31
|
+
else if (p.isOptional) {
|
|
32
|
+
optionalCount++;
|
|
33
|
+
}
|
|
34
|
+
if (p.type !== null)
|
|
35
|
+
types.push(p.type);
|
|
36
|
+
}
|
|
37
|
+
// PHP variadic marker convention: append the literal '...' string to
|
|
38
|
+
// `parameterTypes`. This is intentionally DIFFERENT from C#, which uses
|
|
39
|
+
// the literal 'params' (its source-language keyword). The shared
|
|
40
|
+
// `narrowOverloadCandidates` pass in `scope-resolution/passes/overload-
|
|
41
|
+
// narrowing.ts` checks for the C# 'params' marker — that branch is
|
|
42
|
+
// dead code for PHP because PHP variadic methods set `parameterCount
|
|
43
|
+
// = undefined` (see line below), which skips the `max !== undefined`
|
|
44
|
+
// gate that hosts the 'params' check. PHP's actual variadic-aware
|
|
45
|
+
// arity logic lives in `phpArityCompatibility` (arity.ts) and now
|
|
46
|
+
// also in `phpEmitUnresolvedReceiverEdges` (scope-resolver.ts), both
|
|
47
|
+
// of which check `'...'`. Finding 9 of PR #1497 adversarial review.
|
|
48
|
+
if (hasVariadic)
|
|
49
|
+
types.push('...');
|
|
50
|
+
const total = params.length;
|
|
51
|
+
// Variadic methods accept any arg count ≥ required — leave `parameterCount`
|
|
52
|
+
// undefined so the registry treats max as unknown.
|
|
53
|
+
const parameterCount = hasVariadic ? undefined : total;
|
|
54
|
+
// The variadic slot itself accepts zero args; subtract it from the required
|
|
55
|
+
// count so PHP's ArgumentCountError-equivalent calls (too few args before
|
|
56
|
+
// the variadic) are correctly rejected by arity compatibility.
|
|
57
|
+
const requiredParameterCount = total - optionalCount - (hasVariadic ? 1 : 0);
|
|
58
|
+
return {
|
|
59
|
+
parameterCount,
|
|
60
|
+
requiredParameterCount,
|
|
61
|
+
parameterTypes: types.length > 0 ? types : undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP arity check, accommodating variadic (`...$args`) and default parameters.
|
|
3
|
+
*
|
|
4
|
+
* The `def` metadata synthesized by `arity-metadata.ts`:
|
|
5
|
+
* - `parameterCount` — total formal parameters; `undefined` when
|
|
6
|
+
* the method has a variadic `...$param`.
|
|
7
|
+
* - `requiredParameterCount` — min required (excludes defaulted params
|
|
8
|
+
* and the variadic itself).
|
|
9
|
+
* - `parameterTypes` — declared type strings; contains the
|
|
10
|
+
* literal `'...'` when the method is variadic.
|
|
11
|
+
*
|
|
12
|
+
* Verdicts:
|
|
13
|
+
* - `'compatible'` — `required <= argCount <= max`, OR the def has
|
|
14
|
+
* variadic (any `argCount >= required`).
|
|
15
|
+
* - `'incompatible'` — argCount below required, or above max with no variadic.
|
|
16
|
+
* - `'unknown'` — metadata absent / incomplete; named-args can satisfy
|
|
17
|
+
* any arity so we return unknown when we detect them.
|
|
18
|
+
*
|
|
19
|
+
* PHP supports named arguments (PHP 8.0+): `save(force: true)`. Named-arg
|
|
20
|
+
* call sites cannot be arity-checked statically without parsing arg names,
|
|
21
|
+
* so we return `'unknown'` when the callsite carries named args (signalled
|
|
22
|
+
* by a negative `arity` value per the shared Callsite contract).
|
|
23
|
+
*/
|
|
24
|
+
import type { Callsite, SymbolDefinition } from '../../../../_shared/index.js';
|
|
25
|
+
export declare function phpArityCompatibility(def: SymbolDefinition, callsite: Callsite): 'compatible' | 'unknown' | 'incompatible';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP arity check, accommodating variadic (`...$args`) and default parameters.
|
|
3
|
+
*
|
|
4
|
+
* The `def` metadata synthesized by `arity-metadata.ts`:
|
|
5
|
+
* - `parameterCount` — total formal parameters; `undefined` when
|
|
6
|
+
* the method has a variadic `...$param`.
|
|
7
|
+
* - `requiredParameterCount` — min required (excludes defaulted params
|
|
8
|
+
* and the variadic itself).
|
|
9
|
+
* - `parameterTypes` — declared type strings; contains the
|
|
10
|
+
* literal `'...'` when the method is variadic.
|
|
11
|
+
*
|
|
12
|
+
* Verdicts:
|
|
13
|
+
* - `'compatible'` — `required <= argCount <= max`, OR the def has
|
|
14
|
+
* variadic (any `argCount >= required`).
|
|
15
|
+
* - `'incompatible'` — argCount below required, or above max with no variadic.
|
|
16
|
+
* - `'unknown'` — metadata absent / incomplete; named-args can satisfy
|
|
17
|
+
* any arity so we return unknown when we detect them.
|
|
18
|
+
*
|
|
19
|
+
* PHP supports named arguments (PHP 8.0+): `save(force: true)`. Named-arg
|
|
20
|
+
* call sites cannot be arity-checked statically without parsing arg names,
|
|
21
|
+
* so we return `'unknown'` when the callsite carries named args (signalled
|
|
22
|
+
* by a negative `arity` value per the shared Callsite contract).
|
|
23
|
+
*/
|
|
24
|
+
export function phpArityCompatibility(def, callsite) {
|
|
25
|
+
const max = def.parameterCount;
|
|
26
|
+
const min = def.requiredParameterCount;
|
|
27
|
+
if (max === undefined && min === undefined)
|
|
28
|
+
return 'unknown';
|
|
29
|
+
const argCount = callsite.arity;
|
|
30
|
+
// Negative arity signals named-argument call sites — can't narrow statically.
|
|
31
|
+
if (!Number.isFinite(argCount) || argCount < 0)
|
|
32
|
+
return 'unknown';
|
|
33
|
+
const hasVarArgs = def.parameterTypes !== undefined &&
|
|
34
|
+
def.parameterTypes.some((t) => t === '...' || t.startsWith('...'));
|
|
35
|
+
if (min !== undefined && argCount < min)
|
|
36
|
+
return 'incompatible';
|
|
37
|
+
if (max !== undefined && argCount > max && !hasVarArgs)
|
|
38
|
+
return 'incompatible';
|
|
39
|
+
return 'compatible';
|
|
40
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-mode counters for the cross-phase scope-captures parse cache
|
|
3
|
+
* (PHP mirror of `languages/csharp/cache-stats.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Gated by `PROF_SCOPE_RESOLUTION=1`. Production builds fold every
|
|
6
|
+
* increment into dead code via the module-level `PROF` constant, so
|
|
7
|
+
* the hot path in `captures.ts` stays branch-free.
|
|
8
|
+
*/
|
|
9
|
+
export declare function recordCacheHit(): void;
|
|
10
|
+
export declare function recordCacheMiss(): void;
|
|
11
|
+
export declare function getPhpCaptureCacheStats(): {
|
|
12
|
+
hits: number;
|
|
13
|
+
misses: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function resetPhpCaptureCacheStats(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-mode counters for the cross-phase scope-captures parse cache
|
|
3
|
+
* (PHP mirror of `languages/csharp/cache-stats.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Gated by `PROF_SCOPE_RESOLUTION=1`. Production builds fold every
|
|
6
|
+
* increment into dead code via the module-level `PROF` constant, so
|
|
7
|
+
* the hot path in `captures.ts` stays branch-free.
|
|
8
|
+
*/
|
|
9
|
+
const PROF = process.env.PROF_SCOPE_RESOLUTION === '1';
|
|
10
|
+
let CACHE_HITS = 0;
|
|
11
|
+
let CACHE_MISSES = 0;
|
|
12
|
+
export function recordCacheHit() {
|
|
13
|
+
if (PROF)
|
|
14
|
+
CACHE_HITS++;
|
|
15
|
+
}
|
|
16
|
+
export function recordCacheMiss() {
|
|
17
|
+
if (PROF)
|
|
18
|
+
CACHE_MISSES++;
|
|
19
|
+
}
|
|
20
|
+
export function getPhpCaptureCacheStats() {
|
|
21
|
+
return { hits: CACHE_HITS, misses: CACHE_MISSES };
|
|
22
|
+
}
|
|
23
|
+
export function resetPhpCaptureCacheStats() {
|
|
24
|
+
CACHE_HITS = 0;
|
|
25
|
+
CACHE_MISSES = 0;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `emitScopeCaptures` for PHP (RFC #909 Ring 3 LANG-php).
|
|
3
|
+
*
|
|
4
|
+
* Drives the PHP scope query against tree-sitter-php and groups raw
|
|
5
|
+
* matches into `CaptureMatch[]` for the central extractor. Layers two
|
|
6
|
+
* synthesized streams on top:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Decomposed use declarations** — each `namespace_use_declaration`
|
|
9
|
+
* is re-emitted with `@import.kind/source/name/alias` markers so
|
|
10
|
+
* `interpretPhpImport` can recover the ParsedImport shape without
|
|
11
|
+
* re-parsing raw text. Grouped uses fan out to one match per clause.
|
|
12
|
+
*
|
|
13
|
+
* 2. **Receiver-binding synthesis** — `$this` and `parent` type-bindings
|
|
14
|
+
* are synthesized on every non-static method entry. PHP's grammar
|
|
15
|
+
* does not express "implicit receiver of a non-static class method"
|
|
16
|
+
* via a clean `.scm` pattern, so we walk up the AST in code.
|
|
17
|
+
*
|
|
18
|
+
* 3. **Arity metadata synthesis** — `@declaration.parameter-count` /
|
|
19
|
+
* `@declaration.required-parameter-count` / `@declaration.parameter-types`
|
|
20
|
+
* are synthesized on function-like declarations so the registry can
|
|
21
|
+
* narrow overloads.
|
|
22
|
+
*
|
|
23
|
+
* 4. **PHPDoc synthesis** — @param and @return annotations in comment
|
|
24
|
+
* nodes preceding method/function declarations are extracted and emitted
|
|
25
|
+
* as `@type-binding.parameter` and `@type-binding.return` matches.
|
|
26
|
+
*
|
|
27
|
+
* 5. **Foreach loop synthesis** — `foreach ($users as $user)` emits
|
|
28
|
+
* a `@type-binding.alias` match binding the loop variable to the
|
|
29
|
+
* element type of the iterable (resolved from PHPDoc or scopeEnv).
|
|
30
|
+
*
|
|
31
|
+
* Pure given the input source text. No I/O, no globals consulted.
|
|
32
|
+
*/
|
|
33
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
34
|
+
export declare function emitPhpScopeCaptures(sourceText: string, _filePath: string, cachedTree?: unknown): readonly CaptureMatch[];
|