@codua/codeoutline-win32-x64 0.2.4 → 0.2.6

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/bin/xnet.exe CHANGED
Binary file
package/build-info.json CHANGED
@@ -1 +1 @@
1
- {"target":"win32-x64","lua":"LuaJIT 2.1.1774896198","sourceCommit":"ed96402bbd84f392f4d98a53467ace4b9af4042d","sourceDirty":false,"version":"0.2.4","note":"Release build from a clean checkout","releaseReady":true,"updateSequence":13,"sha256":{"scripts/codeoutline/updater.lua":"267c4b6e9704fce710f44d1bfceac69c1857e34e064d8444d7890f0e10d921c7","scripts/codeoutline/http.lua":"3d957628ecc9592d57cc68a61e5d4229a71da501eb8fb3aa0bbb5e1cd772adf0","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/codeoutline/update_sequence.lua":"bce1625b261d4cbe8d9ed46deaaa4ba0e51188a28eadb29d40a2eb38c7887a86","scripts/codeoutline/index.lua":"b4bd637a5e4c573738ec4e9477ba5090949e7d5b9a35a968d3d4731540ae1630","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/codeoutline/update_worker.lua":"7e2ec28e4b911d7b90fd97d0a4c0e2f5b295d1a9200c5c7250e47a99139ca550","scripts/codeoutline/index_worker.lua":"ad6b300fcca6f2eadb0373179d1c5c3321319a3ab0cae3d9a8996ce760e55671","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/codeoutline/version.lua":"98080592a13c231e3d35fc5b8d8c35406cbb6d9c759d2cc6a786ee489c02d900","scripts/codeoutline/indirect.lua":"6bb422611b82ee370b29c5e1eafa25753fa5e4f722b5f2dcda99ad21a7d55a1e","scripts/codeoutline/xscan.lua":"bd95a1b0b7022d029a41aab615897502478b5834612505e8d299343cb5ca8ef9","scripts/codeoutline/js_evidence.lua":"ddb9f8a4f22b1f7fd397a75c6c5660d434133b5148dbf396586bb5b443161776","README.md":"b58cd12615dd7b796c3a3e8ce86ec0adb36a92f7d32025eed1fb78a843616fcf","README.zh-CN.md":"fea0ffb9835e1b78925b1aa0a6a3019591e376d23e94da5b4f58773601e2d7da","scripts/codeoutline/js_resolution.lua":"76be5143d2d5ff5b381c1cde0c1039fa26cb035f309a0aba7c3683efdcdd4b58","DISTRIBUTION.md":"da4a1048fc9b44670fd6fcef97e7d92ac3f50d3523da1773930c49f7e2c38dc3","THIRD_PARTY.md":"a0d596a8600c5244b27c1426a81b4ec7046d213d733ec6b4287a4b1e8db501b5","scripts/xupgate/client.lua":"967c29c1eeebd8596458025ab3237816a91591cca64236ea0e7ba1762814e6ba","bin/xnet.exe":"e3011f838676974c8b534ed53f18b299d5b08ede9d00a6c8744a0c1aa9de62f8","scripts/codeoutline/lang/python.lua":"1ae8f1658e25220ec4d952c17ed817bfc92d0c45d4585d3dd4716d5585b60cc6","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/callers.lua":"d5b11e92bd32a823f1d198a6e7b4dca73e15daa4713762cf29d1062f26ec20d6","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/cpp.lua":"47e3dc18cbc8b9a93567897e9ff69a026434a1971fe1dcc3e07d3af03c54a4f2","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/cli.lua":"f7ac4addd32ced58069954cb81edd4836c6043bb5d143683b80bd7b11554c733","codeoutline":"3d3970e488e077e8acd67d174b506a361d43578b3360c7b29f2ec3f0103ba899","codeoutline.cmd":"607b60c6d107becdb6793df8f41aaf2cff944baf69f5ece59dba990d0f24c13b","scripts/codeoutline/main.lua":"0e1731a4e931ed8cc3ec42c537bb61c22094c3462fe7c20ed49ed7831ce71bd4","scripts/codeoutline/command.lua":"e4bd7698e03dbca3728084454a2e9a4b1a9902e76c3d69b85107ffac80981716","scripts/codeoutline/mcp.lua":"d68f3648a31befeabb846faae3e13efe4f8c7406f6d9b14a1fab6c77014c6b50","scripts/codeoutline/common.lua":"481731dbaeeb937d516e11031f1bef7d1237eaa0999f372ebc3c22fd1ab1898f","scripts/codeoutline/navigation.lua":"032532577b225d31aad9df7a4667b6e082d6612b234acc2079297d33c6b594a3","scripts/codeoutline/lang/js.lua":"62570ddc38c974991763e11770059880b87ec87f14578891df9d935af6cb4786","scripts/codeoutline/parse.lua":"52eadb0b4b5bb5db2f6064170414377c5a23e2b24b3409ae00b9969273076435","scripts/codeoutline/control.lua":"b67a2e382e021f0793ef313aa4e71faab76f6cb77ca127f499d01ae96f36a8db","scripts/codeoutline/parse_pool.lua":"acaafe74a568ec450e428f4a1a2ff704834588bba0f8b808e4c7a1d552861941","scripts/codeoutline/daemon.lua":"06863991135cc9a85f07bca8310296f0df9e415b3e2de97ae006393e777b009b","scripts/codeoutline/parse_worker.lua":"c5f1745d15332c5040b1e97f6da08f2f456d9afe7c2491275cc97d7113b75e45","scripts/codeoutline/documents.lua":"320a7d40fd5c0fef03a18df586848059a65c0f4e7ab4b218e9e84561eb5a7007","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/codeoutline/explore.lua":"f4e378d300d2ff8dc30ea59a1c8d13f7371e9e49352f203272b420d09f0df240","scripts/codeoutline/lua_bindings.lua":"0ceac2704b3bb2d9b88b6840617d6030d725546ec4b0e19f3ce52aa5be590adb","scripts/codeoutline/lang/lua.lua":"f50a169549475d5d71f8af920feeb82797e8f24ccfe0c3f416abc5a32e942713","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","scripts/codeoutline/query_report.lua":"7b6c5e5aae8bcebd10612e360ee7e4cd0f0795f7594479d54e074e50fd6b97bc","scripts/codeoutline/foreign.lua":"ac5b3868430b4f2f8b5182d86e45305b71fa3ffd9a7f5ce034ac49f31e047008","scripts/codeoutline/lang/kotlin.lua":"cefaad1c412cb42ea6b2027ad9f81ad38d8d821f05c1cfde7f89c600d745a708","scripts/codeoutline/lsp.lua":"5403311a9fd5cdc85bcbe158c35d5f1515d279f8374fc41d1f0c694a629ba824","scripts/codeoutline/lang/rust.lua":"294cee85786caaa5f29dedd5058877c7a4786349431faf33b36357ef69406a9e","scripts/codeoutline/lang/csharp.lua":"4bfa8555955c7de98ea12d36ee6f7d817c40cb87e77350fe2af4783517190a3d","scripts/codeoutline/service.lua":"91ac502048f8e5be4521284ca77f45af1a8f6421aff59c41361c88015a531b03","scripts/codeoutline/foreign_lua.lua":"035e8f38408e3bd9a6923a8551c5c37780496f74720862ad1b45ca820c0c364a","scripts/codeoutline/lang/c.lua":"9cd8abbdfda6cae5d6c04a9ae68bbd9f7589b217e88b7682917106e80df9b0c5","scripts/codeoutline/lang/java.lua":"0ea34298770cb3431f4bc3521c4d2ecf363d55e768d6cd30b3f11ad05d7e8f0d","scripts/xupgate/common.lua":"86267648c0dbbd3a05f90de4d6e1dbee53ba57bf4801783c2ae636224b1f228c","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","scripts/codeoutline/graph.lua":"1e07b86bb47aebce50658fc4f6e691e48e92436803939e5d395676fc6e4fec3b","scripts/codeoutline/lang/go.lua":"3a62d4dc451b0d2f7f2aefd5e77d11449a5d725f59379728eba8dda0aacc13f3","scripts/codeoutline/completion.lua":"4781d195e543a56d0e52cd1e54d451cb4a02dafab60e772daee7b1fad58e6b2c","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c"},"runtimeBuild":"b9b847244c68283df56e7858fe3daaafd35b756f0ff67cfa379f998133ddf29d","runtimeCommit":"d33491598d199b1a2f5fd3d9840c5b17d49b1e13"}
1
+ {"version":"0.2.6","runtimeCommit":"d33491598d199b1a2f5fd3d9840c5b17d49b1e13","runtimeBuild":"b9b847244c68283df56e7858fe3daaafd35b756f0ff67cfa379f998133ddf29d","lua":"LuaJIT 2.1.1774896198","sourceCommit":"e738eb2dff955027fda8ecbe0b397d32d6911e03","sourceDirty":false,"releaseReady":true,"note":"Release build from a clean checkout","sha256":{"scripts/codeoutline/query_report.lua":"5e6052483514c1d3497fe90c2eb70235caed334b4a89411453a2a812f50c6246","scripts/codeoutline/command.lua":"e4bd7698e03dbca3728084454a2e9a4b1a9902e76c3d69b85107ffac80981716","scripts/codeoutline/rules.lua":"b01402863062435a6d31a4a5a90208319876fdb444a76c75fd0c45ea8ee6fee5","scripts/codeoutline/common.lua":"dc76e72f4c8de20f120962bb19bffaa0beafbeddad217fc95b028e4e7d94374a","scripts/codeoutline/service.lua":"91ac502048f8e5be4521284ca77f45af1a8f6421aff59c41361c88015a531b03","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/completion.lua":"aa59fed11e6bcecb4e80a5df42911e05541c4b65bb9aefdd0e7f70b0e8fcfd22","scripts/codeoutline/static_dispatch.lua":"19a4f20ecc85e0e6d49d571fe4f5cc339b6ee6a9968d52d072c62ff4121bcaba","scripts/codeoutline/js_resolution.lua":"b921411cceae30190a0d637605d8f54105a9da907c57c9c361513720feba6dcc","scripts/codeoutline/control.lua":"b67a2e382e021f0793ef313aa4e71faab76f6cb77ca127f499d01ae96f36a8db","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/updater.lua":"267c4b6e9704fce710f44d1bfceac69c1857e34e064d8444d7890f0e10d921c7","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/codeoutline/cpp_types.lua":"b0904638c40bf621f965f9839d4c103dec96cadc98ec7c1b0fa689e379f41804","scripts/codeoutline/update_sequence.lua":"640a1b156e8ce2e54d9e63fd95d179eb07f551e6eeb752d5d36114a7b5867196","scripts/codeoutline/lang/c.lua":"9cd8abbdfda6cae5d6c04a9ae68bbd9f7589b217e88b7682917106e80df9b0c5","scripts/codeoutline/csharp_bindings.lua":"3a237f9a04c4cc2277ebfcbe902bdefecff125ef4a7c8d2d55e8284e916db0ab","scripts/codeoutline/update_worker.lua":"7e2ec28e4b911d7b90fd97d0a4c0e2f5b295d1a9200c5c7250e47a99139ca550","scripts/codeoutline/lang/cpp.lua":"47e3dc18cbc8b9a93567897e9ff69a026434a1971fe1dcc3e07d3af03c54a4f2","scripts/codeoutline/daemon.lua":"06863991135cc9a85f07bca8310296f0df9e415b3e2de97ae006393e777b009b","scripts/codeoutline/version.lua":"098b03a424dd1b59a945f4042470355ca854e3063108e89debca0070dc9145b0","scripts/codeoutline/lang/csharp.lua":"eac54f1664946e2d8278de8530878c14c91b432b62f9d0044e991164df3d0666","scripts/codeoutline/dispatch_aliases.lua":"40c85d2c76efd797cb9cf7355cd18bbac270aaa0fe724c3760695fe97187f83d","scripts/codeoutline/xscan.lua":"bd95a1b0b7022d029a41aab615897502478b5834612505e8d299343cb5ca8ef9","scripts/codeoutline/lang/go.lua":"3a62d4dc451b0d2f7f2aefd5e77d11449a5d725f59379728eba8dda0aacc13f3","scripts/codeoutline/documents.lua":"7e59a60085c68d756f57424925732e205e2559efbf1213716afa620acf0c6c43","scripts/codeoutline/indirect.lua":"ead34f11f48fdb11478f613dd69c83c00fdb4c2840e635da2d5315125395baf9","scripts/codeoutline/lang/java.lua":"0ea34298770cb3431f4bc3521c4d2ecf363d55e768d6cd30b3f11ad05d7e8f0d","scripts/codeoutline/explore.lua":"f9294a11c3155daa41f7a994886e4004fed940468c95d03c1b33859530186236","bin/xnet.exe":"1fa95f25f32f44e49250cda6642a8e6a975e42b3ee8922cbc591ec75ed530848","scripts/xupgate/client.lua":"967c29c1eeebd8596458025ab3237816a91591cca64236ea0e7ba1762814e6ba","scripts/codeoutline/lang/js.lua":"62570ddc38c974991763e11770059880b87ec87f14578891df9d935af6cb4786","scripts/codeoutline/foreign.lua":"a3eab94b652b94dfe2a11c2c33f0744201decdbb84fcbb6d2ef244f2826e9b6e","scripts/codeoutline/lang/kotlin.lua":"cefaad1c412cb42ea6b2027ad9f81ad38d8d821f05c1cfde7f89c600d745a708","scripts/codeoutline/foreign_lua.lua":"03640aa84ba2ba628a5b0d8a7f66285fe308107fdd196862164d29d7e4129660","scripts/codeoutline/mcp.lua":"d68f3648a31befeabb846faae3e13efe4f8c7406f6d9b14a1fab6c77014c6b50","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/graph.lua":"76350b773fc8366102acf471d8ef70bfebc5898eaeba6ded018041c4ecabd69e","DISTRIBUTION.md":"da4a1048fc9b44670fd6fcef97e7d92ac3f50d3523da1773930c49f7e2c38dc3","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/python.lua":"1ae8f1658e25220ec4d952c17ed817bfc92d0c45d4585d3dd4716d5585b60cc6","scripts/codeoutline/http.lua":"3d957628ecc9592d57cc68a61e5d4229a71da501eb8fb3aa0bbb5e1cd772adf0","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/ordinary_bindings.lua":"63bb8d660a74d67c370641793ab983e9b203c344253535ee32b5530d2365a700","scripts/codeoutline/lang/rust.lua":"294cee85786caaa5f29dedd5058877c7a4786349431faf33b36357ef69406a9e","scripts/codeoutline/index.lua":"f258c8085c5a93ac57c9ae9d21ee92c2be4850e21672b8af650dfee8ecbbc48e","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","scripts/codeoutline/parse.lua":"52eadb0b4b5bb5db2f6064170414377c5a23e2b24b3409ae00b9969273076435","scripts/codeoutline/lsp.lua":"5403311a9fd5cdc85bcbe158c35d5f1515d279f8374fc41d1f0c694a629ba824","codeoutline":"3d3970e488e077e8acd67d174b506a361d43578b3360c7b29f2ec3f0103ba899","scripts/codeoutline/parse_pool.lua":"acaafe74a568ec450e428f4a1a2ff704834588bba0f8b808e4c7a1d552861941","scripts/codeoutline/lua_bindings.lua":"e8c8a44dffd7e263dcfb321682c382d3d9d691495dbcb143a049532859d4ed53","codeoutline.cmd":"607b60c6d107becdb6793df8f41aaf2cff944baf69f5ece59dba990d0f24c13b","THIRD_PARTY.md":"a0d596a8600c5244b27c1426a81b4ec7046d213d733ec6b4287a4b1e8db501b5","README.zh-CN.md":"fea0ffb9835e1b78925b1aa0a6a3019591e376d23e94da5b4f58773601e2d7da","README.md":"b58cd12615dd7b796c3a3e8ce86ec0adb36a92f7d32025eed1fb78a843616fcf","scripts/codeoutline/parse_worker.lua":"c5f1745d15332c5040b1e97f6da08f2f456d9afe7c2491275cc97d7113b75e45","scripts/codeoutline/lua_literal.lua":"5fdd90a872988622337410c7e516d41b789ce4326c4aa6dddcd61998fe5aef90","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/codeoutline/main.lua":"0e1731a4e931ed8cc3ec42c537bb61c22094c3462fe7c20ed49ed7831ce71bd4","scripts/codeoutline/callers.lua":"d5b11e92bd32a823f1d198a6e7b4dca73e15daa4713762cf29d1062f26ec20d6","scripts/codeoutline/lang/lua.lua":"f50a169549475d5d71f8af920feeb82797e8f24ccfe0c3f416abc5a32e942713","scripts/codeoutline/js_evidence.lua":"494f6f90c3da2eee0e8f6b21f8ce364802ed1ee710e74c443f1cfbbd575859f6","scripts/codeoutline/navigation.lua":"69001bab3763fb974a66cdeab5fe88c8b52f7e9229f8243ad6a30a26932c3418","scripts/codeoutline/python_bindings.lua":"e33a0ff223cf3b3292cbe9ed728aa32f6c5cab47d1843d6797ae670b74a3c580","scripts/codeoutline/index_worker.lua":"ad6b300fcca6f2eadb0373179d1c5c3321319a3ab0cae3d9a8996ce760e55671","scripts/codeoutline/cpp_bindings.lua":"b302b0a0e99846853ec75532a5a10e5da2f6738f512ca7b6f57fa98aaed17018","scripts/xupgate/common.lua":"86267648c0dbbd3a05f90de4d6e1dbee53ba57bf4801783c2ae636224b1f228c","scripts/codeoutline/cli.lua":"f7ac4addd32ced58069954cb81edd4836c6043bb5d143683b80bd7b11554c733","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675"},"target":"win32-x64","updateSequence":15}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@codua/codeoutline-win32-x64","files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"version":"0.2.4","publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","repository":{"type":"git","url":"git+https://github.com/1dao/codeoutline.git"},"os":["win32"]}
1
+ {"name":"@codua/codeoutline-win32-x64","version":"0.2.6","files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"os":["win32"],"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","repository":{"url":"git+https://github.com/1dao/codeoutline.git","type":"git"},"cpu":["x64","arm64"],"license":"BSD-2-Clause"}
@@ -25,7 +25,9 @@ local text = require('codeoutline.text')
25
25
  function M.new(path, language, opts)
26
26
  return { path = path, language = language, nodes = {}, refs = {}, imports = {},
27
27
  ranges = not opts or opts.ranges ~= false, collect_dispatch = opts and opts.dispatch,
28
- dispatch_only = opts and opts.dispatch_only }
28
+ dispatch_only = opts and opts.dispatch_only, collect_static_dispatch = opts and opts.static_dispatch,
29
+ ordinary_bindings = opts and opts.ordinary_bindings,
30
+ collect_foreign = opts and opts.foreign, omit_signatures = opts and opts.omit_signatures }
29
31
  end
30
32
 
31
33
  -- Collapse a token span into a one-line signature.
@@ -132,10 +134,13 @@ end
132
134
 
133
135
  -- Drop parser-internal fields so the result is plain data.
134
136
  function M.finish(r, T)
135
- if T and (r.language == 'c' or r.language == 'cpp') then
137
+ if T and r.collect_foreign and (r.language == 'c' or r.language == 'cpp') then
136
138
  require('codeoutline.foreign').collect(r, T)
137
139
  end
140
+ r.collect_foreign = nil
138
141
  M.assign_refs(r)
142
+ if T then require('codeoutline.static_dispatch').collect(r, T) end
143
+ r.collect_static_dispatch = nil
139
144
  -- Query-only parse: preserve normal declaration/call attribution, but do
140
145
  -- not build binding evidence or compact records that will be discarded.
141
146
  if r.dispatch_only then
@@ -144,16 +149,24 @@ function M.finish(r, T)
144
149
  return r
145
150
  end
146
151
  if T then require('codeoutline.js_evidence').collect(r, T) end
152
+ if T and r.ordinary_bindings then
153
+ require('codeoutline.python_bindings').collect(r, T)
154
+ require('codeoutline.cpp_bindings').collect(r, T)
155
+ if r.language == 'csharp' then require('codeoutline.csharp_bindings').collect(r, T) end
156
+ end
147
157
  if T then require('codeoutline.indirect').collect(r, T) end
148
158
  r.collect_dispatch = nil
149
159
  local name, from, kind, line, recv = {}, {}, {}, {}, {}
150
160
  local js_receiver = r.js_imports and {}
151
161
  local lua_binding = r.lua_imports and {}
162
+ local binding = (r.python_imports or r.has_bindings) and {}
163
+ r.has_bindings = nil
152
164
  local start, stop = r.ranges and T and {}, r.ranges and T and {}
153
165
  for i, ref in ipairs(r.refs) do
154
166
  name[i], from[i], kind[i], line[i], recv[i] = ref.name, ref.from, ref.kind, ref.line, ref.recv or false
155
167
  if js_receiver then js_receiver[i] = ref.js_receiver or '' end
156
168
  if lua_binding then lua_binding[i] = ref.lua_binding or '' end
169
+ if binding then binding[i] = ref.binding or '' end
157
170
  if start then
158
171
  local named = T:text(ref.tok) == ref.name
159
172
  start[i], stop[i] = named and T.s[ref.tok] - 1 or false, named and T.e[ref.tok] or false
@@ -162,20 +175,22 @@ function M.finish(r, T)
162
175
  r.refs = { name = name, from = from, kind = kind, line = line, recv = recv, start = start or nil, stop = stop or nil }
163
176
  r.refs.js_receiver = js_receiver
164
177
  r.refs.lua_binding = lua_binding
178
+ r.refs.binding = binding
165
179
  for i, n in ipairs(r.nodes) do
166
180
  n.ti, n.tj = nil, nil
167
181
  if not r.ranges then
168
182
  -- Rebuild: deleting keys does not shrink Lua table allocations.
169
183
  local compact = {}
170
184
  for key, value in pairs(n) do
171
- if key ~= 'start_byte' and key ~= 'end_byte' and key ~= 'name_start' and key ~= 'name_end' then
185
+ if key ~= 'start_byte' and key ~= 'end_byte' and key ~= 'name_start' and key ~= 'name_end'
186
+ and not (r.omit_signatures and key == 'sig') then
172
187
  compact[key] = value
173
188
  end
174
189
  end
175
190
  r.nodes[i] = compact
176
191
  end
177
192
  end
178
- r.ranges = nil
193
+ r.ranges, r.omit_signatures = nil, nil
179
194
  r.prefix, r.skip_calls = nil, nil
180
195
  return r
181
196
  end
@@ -11,10 +11,9 @@
11
11
  -- files are reparsed on demand within a time budget; running out of it, or
12
12
  -- of items, marks the list incomplete.
13
13
  local graph = require('codeoutline.graph')
14
- local parse = require('codeoutline.parse')
15
14
  local navigation = require('codeoutline.navigation')
16
15
  local control = require('codeoutline.control')
17
- local M = { MAX_ITEMS = 500, BUDGET_SECONDS = 0.3, MAX_FILE_BYTES = 524288, MAX_DEPTH = 6, CACHE_FILES = 64 }
16
+ local M = { MAX_ITEMS = 500, BUDGET_SECONDS = 0.3, MAX_DEPTH = 6 }
18
17
 
19
18
  local ITEM = { ['function'] = 3, method = 2, constructor = 4, destructor = 4, field = 5, variable = 6,
20
19
  property = 10, class = 7, struct = 22, union = 22, record = 22, interface = 8, enum = 13, enum_member = 20,
@@ -41,9 +40,6 @@ for word in ([[Option Box Rc Arc RefCell Cell Mutex RwLock Weak unique_ptr share
41
40
  local TYPE_AFTER = { go = true, rust = true, typescript = true, javascript = true, python = true, kotlin = true }
42
41
  local DYNAMIC = { lua = true, python = true, javascript = true, typescript = true }
43
42
 
44
- -- Full parses of type files, keyed by the index record they correspond to.
45
- local cache, cache_order = setmetatable({}, { __mode = 'k' }), {}
46
-
47
43
  local function text_of(T, i) return T.s[i] and T:text(i) or '' end
48
44
  local function is(T, i, s) return T.k[i] == 'op' and text_of(T, i) == s end
49
45
  local function kw(T, i, s) return T.k[i] == 'kw' and text_of(T, i) == s end
@@ -57,13 +53,21 @@ end
57
53
 
58
54
  -- Type name for a declared type text: modifiers, pointers, references,
59
55
  -- arrays, namespaces and well-known wrappers removed.
60
- local function normalize(text)
56
+ local function normalize(text, language)
61
57
  if type(text) ~= 'string' then return nil end
58
+ if language == 'cpp' then
59
+ local named = require('codeoutline.cpp_types').normalize(text)
60
+ if named then return named end
61
+ end
62
62
  text = text:gsub('^%s+', ''):gsub('%s+$', '')
63
63
  for _ = 1, 8 do
64
64
  local first, rest = text:match('^([%a_]+)%s+(.+)$')
65
65
  if first and MODIFIERS[first] then text = rest else break end
66
66
  end
67
+ if language == 'csharp' then
68
+ local named = require('codeoutline.csharp_bindings').name(text)
69
+ if named then return named end
70
+ end
67
71
  text = text:gsub('^[%*&%[%]]+', ''):gsub('[%*&%?!%s]+$', ''):gsub('%[%]$', '')
68
72
  text = text:gsub('^%[%d*%]', ''):gsub('^map%b[]', '')
69
73
  local outer, inner = text:match('^([%w_:%.]+)%s*<(.*)>$')
@@ -91,7 +95,7 @@ end
91
95
 
92
96
  -- Declared type of a node from its signature (or the full-parse `type`).
93
97
  local function declared(node, language)
94
- if node.type then return normalize(node.type) end
98
+ if node.type then return normalize(node.type, language) end
95
99
  local sig, name = node.sig, node.name
96
100
  if not sig then return nil end
97
101
  if node.kind == 'constructor' then return nil end
@@ -117,7 +121,7 @@ local function declared(node, language)
117
121
  end
118
122
  local at = sig:find('[%w_]*' .. name .. '%s*%(')
119
123
  if not at then return nil end
120
- return normalize(strip_name(sig:sub(1, at - 1), name))
124
+ return normalize(strip_name(sig:sub(1, at - 1), name), language)
121
125
  end
122
126
  if language == 'go' then
123
127
  return normalize(sig:match('^%s*' .. name .. '%s+(.+)$'))
@@ -130,36 +134,12 @@ local function declared(node, language)
130
134
  local at
131
135
  for position in sig:gmatch('()' .. name .. '%f[^%w_]') do at = position end
132
136
  if not at or at == 1 then return nil end
133
- return normalize(sig:sub(1, at - 1))
137
+ return normalize(sig:sub(1, at - 1), language)
134
138
  end
135
139
 
136
140
  -- Full record and tokens of file f: the overlay document, else a cached
137
141
  -- reparse of the indexed file (nil when too large or unreadable).
138
- local function full(V, f)
139
- local draft = V.drafts[f]
140
- if draft then
141
- draft.completion = draft.completion or {}
142
- local entry = draft.completion
143
- if not entry.rec then entry.rec, entry.tokens = parse.parse_tokens(draft.path or V.files[f].path, draft.source) end
144
- return entry.rec, entry.tokens, draft
145
- end
146
- local key = V.files[f]
147
- local entry = cache[key]
148
- if entry == nil then
149
- if (key.size or 0) > M.MAX_FILE_BYTES then cache[key] = false; return nil end
150
- local doc = navigation.source_doc(V, f)
151
- entry = false
152
- if doc then
153
- local rec, tokens = parse.parse_tokens(key.path, doc.source)
154
- entry = rec and { rec = rec, tokens = tokens } or false
155
- end
156
- cache[key] = entry
157
- cache_order[#cache_order + 1] = key
158
- if #cache_order > M.CACHE_FILES then cache[table.remove(cache_order, 1)] = nil end
159
- end
160
- if not entry then return nil end
161
- return entry.rec, entry.tokens
162
- end
142
+ local full = navigation.full
163
143
 
164
144
  -- Parameters inside parentheses [a, b] of a function header.
165
145
  local function parameters(T, a, b, language, out)
@@ -204,7 +184,7 @@ local function parameters(T, a, b, language, out)
204
184
  else
205
185
  local name
206
186
  for k = y, x, -1 do if T.k[k] == 'id' then name = k; break end end
207
- if name and name > x then out[#out + 1] = { name = text_of(T, name), type = normalize(span(T, x, name - 1)) } end
187
+ if name and name > x then out[#out + 1] = { name = text_of(T, name), type = normalize(span(T, x, name - 1), language), at = name } end
208
188
  end
209
189
  end
210
190
  for _, name in ipairs(pending) do out[#out + 1] = { name = name } end
@@ -274,7 +254,7 @@ local function declarations(T, a, b, language, skip, out)
274
254
  return b
275
255
  end
276
256
  local function add(name_tok, type, init)
277
- local entry = { name = text_of(T, name_tok), type = normalize(type), at = name_tok }
257
+ local entry = { name = text_of(T, name_tok), type = normalize(type, language), at = name_tok }
278
258
  if init then
279
259
  local stop = statement_end(init)
280
260
  local value = initializer(T, init, stop, language)
@@ -468,11 +448,26 @@ local Completion = {}
468
448
  Completion.__index = Completion
469
449
 
470
450
  -- Type nodes named name, as seen from file f.
471
- function Completion:types(name, f)
451
+ function Completion:types(name, f, scope, at)
472
452
  if not name then return {} end
473
453
  f = f or self.f
474
454
  local accept = self.language == 'lua' and LUA_TYPES or TYPES
475
455
  local direct, paired = navigation.deps(self.V, f)
456
+ if self.V.files[f].language == 'csharp' then
457
+ local ids = require('codeoutline.csharp_bindings').types(self.V, f, name,
458
+ at or (f == self.f and self.offset) or 0, self.V.js_context, { scope = scope })
459
+ return ids
460
+ end
461
+ if self.V.files[f].language == 'cpp' then
462
+ if not scope and f == self.f then
463
+ local owner = self.fn and self.rec.nodes[self.fn] or self.owner and self.rec.nodes[self.owner]
464
+ scope = owner and (CALLABLE[owner.kind] and owner.qualified:match('^(.*)::[^:]+$') or owner.qualified)
465
+ end
466
+ if at == nil and f == self.f then at = self.offset end
467
+ local ids, known = require('codeoutline.cpp_types').resolve(self.V, f, name,
468
+ { scope = scope, at = at or nil, deps = direct, context = self.V.js_context, accept = TYPES })
469
+ if known then return ids end
470
+ end
476
471
  local found = graph.resolve(self.V, f, nil, name, 'call', nil, direct, paired, accept) or {}
477
472
  if #found == 0 then
478
473
  local family = graph.family(self.V.files[f].language)
@@ -552,7 +547,7 @@ function Completion:members(ids, depth, seen)
552
547
  -- Base classes.
553
548
  if depth < 3 and node.bases then
554
549
  for _, base in ipairs(node.bases) do
555
- local base_ids = self:types(normalize(base), f)
550
+ local base_ids = self:types(normalize(base, self.language), f, node.qualified:match('^(.*)::[^:]+$'), false)
556
551
  for _, entry in ipairs(self:members(base_ids, depth + 1, seen)) do out[#out + 1] = entry end
557
552
  end
558
553
  end
@@ -615,9 +610,9 @@ function Completion:module_members(files, module_name)
615
610
  if self:expired() then break end
616
611
  local rec = self.V.files[g]
617
612
  local language = rec.language
618
- local native = rec.foreign_exports and rec.foreign_exports[self.language]
613
+ local native = require('codeoutline.foreign').exports(rec, self.language, module_name)
619
614
  if native then
620
- for name, n in pairs(native[module_name] or {}) do
615
+ for name, n in pairs(native) do
621
616
  local node = rec.nodes[n]
622
617
  out[#out + 1] = { name = name, kind = node.kind, node = node, file = g }
623
618
  end
@@ -765,6 +760,12 @@ end
765
760
  -- A receiver: { types = ids } or { modules = files }.
766
761
  function Completion:receiver(item, depth)
767
762
  local name = item.name
763
+ if self.language == 'lua' then
764
+ local target, bound = require('codeoutline.lua_bindings').receiver(
765
+ self.V, self.rec, self.T, name, self.offset, self.V.js_context.lua)
766
+ if target then return target end
767
+ if bound then return { owner = name, local_only = true } end
768
+ end
768
769
  if SELF[name] or (self.language == 'rust' and name == 'self') then
769
770
  local ids = self:self_types()
770
771
  if #ids > 0 then return { types = ids } end
@@ -774,7 +775,7 @@ function Completion:receiver(item, depth)
774
775
  if entry.module then
775
776
  return { modules = import_files(self.V, self.f, { kind = entry.module_kind or 'require', path = entry.module }), module_name = entry.module }
776
777
  elseif entry.type then
777
- local ids = self:types(entry.type)
778
+ local ids = self:types(entry.type, nil, nil, entry.at and self.T.s[entry.at] - 1)
778
779
  if #ids > 0 then return { types = ids } end
779
780
  elseif entry.chain and depth < M.MAX_DEPTH then
780
781
  return self:chain(entry.chain, depth + 1)
@@ -792,6 +793,12 @@ function Completion:receiver(item, depth)
792
793
  local files = require('codeoutline.lua_bindings').native_modules(self.V, name, self.V.js_context.lua)
793
794
  if #files > 0 then return { modules = files, module_name = name } end
794
795
  end
796
+ if self.language == 'csharp' then
797
+ if name == 'global' then return { csharp_namespace = '' } end
798
+ local ids, namespace, known = require('codeoutline.csharp_bindings').types(self.V, self.f, name, self.offset, self.V.js_context)
799
+ if namespace then return { csharp_namespace = namespace } end
800
+ if known then return #ids > 0 and { types = ids, static = not item.call } or nil end
801
+ end
795
802
  local ids = self:types(name)
796
803
  if #ids > 0 then return { types = ids, static = true } end
797
804
  -- Dynamic languages: a global table with members defined elsewhere, or a
@@ -802,13 +809,27 @@ end
802
809
 
803
810
  function Completion:entries(target)
804
811
  if not target then return {} end
812
+ if target.csharp_namespace ~= nil then
813
+ return require('codeoutline.csharp_bindings').namespace_members(self.V, self.f, target.csharp_namespace, self.V.js_context)
814
+ end
805
815
  if target.modules then return self:module_members(target.modules, target.module_name) end
806
816
  if target.owner then
807
817
  local out = target.local_only and {} or self:owned(target.owner, graph.family(self.language))
808
818
  for _, entry in ipairs(self:assigned(target.owner)) do out[#out + 1] = entry end
809
819
  return out
810
820
  end
811
- return self:members(target.types)
821
+ local entries = self:members(target.types)
822
+ if self.language == 'csharp' then
823
+ local kept = {}
824
+ for _, entry in ipairs(entries) do
825
+ local n = entry.node
826
+ local bindings = require('codeoutline.csharp_bindings')
827
+ if not n or TYPES[n.kind] or (bindings.static_node(self.V, entry.file, n, self.V.js_context) == (target.static or false)
828
+ and bindings.visible_node(self.V, self.f, entry.file, n, self.offset, self.V.js_context)) then kept[#kept + 1] = entry end
829
+ end
830
+ return kept
831
+ end
832
+ return entries
812
833
  end
813
834
 
814
835
  -- Type of a receiver chain, element by element.
@@ -817,23 +838,38 @@ function Completion:chain(chain, depth)
817
838
  local target = self:receiver(chain[1], depth)
818
839
  for k = 2, #chain do
819
840
  if not target or self:expired() then return nil end
820
- local element, next_ids = chain[k], {}
841
+ local element, next_ids, next_files, next_module, next_namespace, next_static = chain[k], {}, nil, nil, nil, nil
821
842
  for _, entry in ipairs(self:entries(target)) do
822
843
  if entry.name == element.name then
823
844
  local node = entry.node
824
- if TYPES[node.kind] then
845
+ if self.language == 'csharp' and node.kind == 'namespace' then next_namespace = node.qualified
846
+ elseif self.language == 'csharp' and TYPES[node.kind] then
847
+ next_static = not element.call
848
+ local ids = require('codeoutline.csharp_bindings').types(self.V, self.f, 'global::' .. node.qualified, self.offset, self.V.js_context)
849
+ for _, id in ipairs(ids) do next_ids[#next_ids + 1] = id end
850
+ elseif TYPES[node.kind] then
825
851
  for _, id in ipairs(self:types(node.name, entry.file)) do next_ids[#next_ids + 1] = id end
826
852
  else
827
- local type = declared(node, self.V.files[entry.file].language)
853
+ local detail = navigation.detail(self.V, entry.file, node)
854
+ local type = declared(detail, self.V.files[entry.file].language)
828
855
  if not type and element.call and FACTORY[element.name] and target.types then
829
856
  for _, id in ipairs(target.types) do next_ids[#next_ids + 1] = id end
830
857
  elseif type then
831
- for _, id in ipairs(self:types(type, entry.file)) do next_ids[#next_ids + 1] = id end
858
+ local scope = node.qualified:match('^(.*)::[^:]+$')
859
+ or self.language == 'csharp' and node.qualified:match('^(.*)%.[^.]+$')
860
+ for _, id in ipairs(self:types(type, entry.file, scope, self.language == 'csharp' and detail.name_start or false)) do next_ids[#next_ids + 1] = id end
861
+ end
862
+ if #next_ids == 0 and element.call and self.language == 'lua' then
863
+ -- A native object: the C implementation names the metatable
864
+ -- it returns, which is the type the guest sees.
865
+ local value = require('codeoutline.lua_bindings').return_target(self.V, node, self.V.js_context.lua)
866
+ if value then next_files, next_module = value.modules, value.module_name end
832
867
  end
833
868
  end
834
869
  end
835
870
  end
836
- target = #next_ids > 0 and { types = next_ids } or nil
871
+ target = next_namespace and { csharp_namespace = next_namespace } or #next_ids > 0 and { types = next_ids, static = next_static }
872
+ or (next_module and { modules = next_files, module_name = next_module } or nil)
837
873
  end
838
874
  return target
839
875
  end
@@ -856,9 +892,10 @@ local function receiver_chain(T, op, member)
856
892
  return #chain > 0 and chain or nil
857
893
  end
858
894
 
859
- local function item_for(entry, language)
895
+ local function item_for(entry, language, V, details)
860
896
  local node = entry.node
861
897
  local foreign = node and require('codeoutline.foreign').signature(node, language, entry.name)
898
+ if details and node and entry.file and not foreign then node = navigation.detail(V, entry.file, node) end
862
899
  return { label = entry.name, kind = ITEM[entry.kind] or 6,
863
900
  detail = foreign and foreign.label or (node and (node.sig or (node.type and (node.type .. ' ' .. entry.name))) or entry.detail) }
864
901
  end
@@ -903,6 +940,21 @@ function M.complete(req)
903
940
  detail = entry.type and (entry.type .. ' ' .. entry.name) or nil }
904
941
  end
905
942
  for alias in pairs(self.aliases) do entries[#entries + 1] = { name = alias, kind = 'namespace', detail = 'module' } end
943
+ if self.language == 'csharp' then
944
+ local bindings = require('codeoutline.csharp_bindings')
945
+ for _, entry in ipairs(bindings.usings(V, f, self.offset, V.js_context)) do
946
+ local d = entry.directive
947
+ if d.alias then entries[#entries + 1] = { name = d.alias:gsub('^@', ''), kind = 'class', detail = d.path }
948
+ elseif d.static then
949
+ local ids = bindings.types(V, entry.file, d.path, d.first, V.js_context,
950
+ { exclude = d.first, no_global = true, scope = d.scope })
951
+ for _, member in ipairs(self:members(ids)) do
952
+ if TYPES[member.kind] or bindings.static_node(V, member.file, member.node, V.js_context)
953
+ and bindings.visible_node(V, f, member.file, member.node, self.offset, V.js_context) then entries[#entries + 1] = member end
954
+ end
955
+ end
956
+ end
957
+ end
906
958
  for _, node in ipairs(self.rec.nodes) do
907
959
  if not node.parent and (self.language == 'kotlin' or not node.qualified:find('[%.:]')) then
908
960
  entries[#entries + 1] = { name = node.name, kind = node.kind, node = node, file = f }
@@ -969,7 +1021,7 @@ function M.complete(req)
969
1021
  if not seen[entry.name] then
970
1022
  seen[entry.name] = true
971
1023
  if #items >= M.MAX_ITEMS then self.incomplete = true; break end
972
- items[#items + 1] = item_for(entry, self.language)
1024
+ items[#items + 1] = item_for(entry, self.language, V, not self:expired())
973
1025
  end
974
1026
  end
975
1027
  return { items = items, incomplete = self.incomplete }
@@ -0,0 +1,116 @@
1
+ -- Bounded declared receiver types. Source evidence is compact; lookup uses the
2
+ -- same symbol tables and include visibility as ordinary graph queries.
3
+ local M = {}
4
+ local control = require('codeoutline.control')
5
+ local types = { class = true, struct = true, union = true }
6
+ local qualifiers = { const = true, volatile = true, static = true, mutable = true, struct = true, class = true }
7
+ local boundary = { [';'] = true, ['{'] = true, ['}'] = true, ['('] = true, [','] = true, [':'] = true }
8
+ local primitive = { auto = true, int = true, double = true, float = true, char = true, bool = true,
9
+ long = true, short = true, unsigned = true, signed = true, void = true }
10
+
11
+ function M.collect(r, T)
12
+ if r.language ~= 'cpp' then return end
13
+ require('codeoutline.cpp_types').collect(r, T)
14
+ local wanted = {}
15
+ for _, ref in ipairs(r.refs) do
16
+ if ref.kind == 'member_call' and ref.recv and ref.recv ~= 'this' then wanted[ref.recv] = true end
17
+ end
18
+ if not next(wanted) then return end
19
+ r.has_bindings = true
20
+ local scopes, stack = {}, {}
21
+ for i = 1, T.n do
22
+ if T:text(i) == '{' and T.m[i] then stack[#stack + 1] = i end
23
+ scopes[i] = stack[#stack] or 0
24
+ if stack[#stack] and T.m[stack[#stack]] == i then stack[#stack] = nil end
25
+ end
26
+ local bindings = {}
27
+ for i = 1, T.n do
28
+ if i % 4096 == 0 then control.check() end
29
+ if T.k[i] == 'id' and wanted[T:text(i)] then
30
+ local after = T:text(i + 1)
31
+ if after == ')' or after == ',' or after == ';' or after == '=' or after == '{' then
32
+ local j = i - 1
33
+ while T:text(j) == '*' or T:text(j) == '&' or T:text(j) == '&&' or qualifiers[T:text(j)] do j = j - 1 end
34
+ if T.k[j] == 'id' or primitive[T:text(j)] then
35
+ local ty = T:text(j)
36
+ j = j - 1
37
+ while T:text(j) == '::' and T.k[j - 1] == 'id' do
38
+ ty = T:text(j - 1) .. '::' .. ty; j = j - 2
39
+ end
40
+ if T:text(j) == '::' then ty = '::' .. ty; j = j - 1 end
41
+ while qualifiers[T:text(j)] do j = j - 1 end
42
+ while primitive[T:text(j)] do j = j - 1 end
43
+ if j == 0 or boundary[T:text(j)] then
44
+ local a = scopes[i]
45
+ local b = a > 0 and T.m[a] or T.n
46
+ for _, n in ipairs(r.nodes) do
47
+ if (n.kind == 'function' or n.kind == 'method' or n.kind == 'constructor')
48
+ and n.ti <= i and i <= n.tj and n.ti > a then a, b = n.ti, n.tj end
49
+ end
50
+ bindings[T:text(i)] = bindings[T:text(i)] or {}
51
+ bindings[T:text(i)][#bindings[T:text(i)] + 1] = { token = i, a = a, b = b, type = ty }
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ for _, ref in ipairs(r.refs) do
58
+ if ref.kind == 'member_call' and ref.recv then
59
+ local best
60
+ for _, b in ipairs(bindings[ref.recv] or {}) do
61
+ if b.a <= ref.tok and ref.tok <= b.b and b.token < ref.tok
62
+ and (not best or b.a > best.a or b.a == best.a and b.token > best.token) then best = b end
63
+ end
64
+ if best then
65
+ ref.binding = 'cpp:type:' .. best.type .. '\0' .. (T.s[best.token] - 1)
66
+ -- A chain's tail is not the simple local sharing that name.
67
+ if T:text(ref.tok - 3) == '.' or T:text(ref.tok - 3) == '->' then ref.binding = 'cpp:?' end
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ function M.resolve(G, f, src, name, evidence, deps, ctx)
74
+ if G.files[f].language ~= 'cpp' or not evidence or evidence:sub(1, 4) ~= 'cpp:' then return nil end
75
+ local ty = evidence:match('^cpp:type:(.+)$')
76
+ if not ty then return {} end
77
+ local written, at = ty:match('^(.-)%z(%d+)$')
78
+ ty = written or ty
79
+ local function classes(written, scope, file, position)
80
+ return require('codeoutline.cpp_types').resolve(G, file or f, written,
81
+ { scope = scope, at = position, deps = deps, context = ctx })
82
+ end
83
+ local scope = src and G.nodes[src].qualified:match('^(.*)::[^:]+$')
84
+ local result, seen, emitted = {}, {}, {}
85
+ local function members(cls, depth)
86
+ control.check()
87
+ if seen[cls] or depth > 8 then return end
88
+ seen[cls] = true
89
+ local q = G.nodes[cls].qualified .. '::' .. name
90
+ local matches, has_definition = {}, false
91
+ for _, id in ipairs(G.by_name[name] or {}) do
92
+ local n = G.nodes[id]
93
+ local owner = n.parent and G.files[G.node_file[id]].nodes[n.parent]
94
+ if n.qualified == q and G.files[G.node_file[id]].language == 'cpp'
95
+ and (not owner or not types[owner.kind] or G.id_of[G.node_file[id]][n.parent] == cls) then
96
+ matches[#matches + 1] = id
97
+ if not n.decl and n.kind ~= 'prototype' then has_definition = true end
98
+ end
99
+ end
100
+ for _, id in ipairs(matches) do
101
+ local n = G.nodes[id]
102
+ if not emitted[id] and (not has_definition or not n.decl and n.kind ~= 'prototype') then
103
+ emitted[id] = true; result[#result + 1] = id
104
+ end
105
+ end
106
+ if #matches == 0 then
107
+ for _, base in ipairs(G.nodes[cls].bases or {}) do
108
+ for _, id in ipairs(classes(base, G.nodes[cls].qualified:match('^(.*)::[^:]+$'), G.node_file[cls])) do members(id, depth + 1) end
109
+ end
110
+ end
111
+ end
112
+ for _, cls in ipairs(classes(ty, scope, f, tonumber(at))) do members(cls, 0) end
113
+ return result
114
+ end
115
+
116
+ return M