@quolu/lattice 0.69.5 → 0.71.0
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.ja.md +5 -1
- package/package.json +1 -1
- package/sensor/dist/bin/lattice-sensor.js +746 -323
- package/sensor/dist/bin/viewer-gate.d.ts +17 -0
- package/sensor/dist/bin/viewer-gate.d.ts.map +1 -0
- package/sensor/dist/bin/viewer-gate.js +31 -0
- package/sensor/dist/bin/viewer-gate.js.map +1 -0
- package/sensor/dist/context/formatter.d.ts +7 -1
- package/sensor/dist/context/formatter.d.ts.map +1 -1
- package/sensor/dist/context/formatter.js +12 -6
- package/sensor/dist/context/formatter.js.map +1 -1
- package/sensor/dist/context/index.d.ts +12 -0
- package/sensor/dist/context/index.d.ts.map +1 -1
- package/sensor/dist/context/index.js +103 -16
- package/sensor/dist/context/index.js.map +1 -1
- package/sensor/dist/db/index.d.ts +23 -2
- package/sensor/dist/db/index.d.ts.map +1 -1
- package/sensor/dist/db/index.js +109 -31
- package/sensor/dist/db/index.js.map +1 -1
- package/sensor/dist/db/migrations.d.ts +1 -1
- package/sensor/dist/db/migrations.d.ts.map +1 -1
- package/sensor/dist/db/migrations.js +68 -1
- package/sensor/dist/db/migrations.js.map +1 -1
- package/sensor/dist/db/queries.d.ts +583 -6
- package/sensor/dist/db/queries.d.ts.map +1 -1
- package/sensor/dist/db/queries.js +1425 -57
- package/sensor/dist/db/queries.js.map +1 -1
- package/sensor/dist/db/schema.sql +27 -4
- package/sensor/dist/db/sqlite-adapter.d.ts +2 -0
- package/sensor/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/sensor/dist/db/sqlite-adapter.js +56 -7
- package/sensor/dist/db/sqlite-adapter.js.map +1 -1
- package/sensor/dist/db/synthesis-stage.d.ts +12 -0
- package/sensor/dist/db/synthesis-stage.d.ts.map +1 -0
- package/sensor/dist/db/synthesis-stage.js +93 -0
- package/sensor/dist/db/synthesis-stage.js.map +1 -0
- package/sensor/dist/db/wal-valve.d.ts +32 -12
- package/sensor/dist/db/wal-valve.d.ts.map +1 -1
- package/sensor/dist/db/wal-valve.js +65 -22
- package/sensor/dist/db/wal-valve.js.map +1 -1
- package/sensor/dist/db/wsl-shared-index.d.ts +53 -0
- package/sensor/dist/db/wsl-shared-index.d.ts.map +1 -0
- package/sensor/dist/db/wsl-shared-index.js +121 -0
- package/sensor/dist/db/wsl-shared-index.js.map +1 -0
- package/sensor/dist/directory.d.ts +126 -2
- package/sensor/dist/directory.d.ts.map +1 -1
- package/sensor/dist/directory.js +285 -16
- package/sensor/dist/directory.js.map +1 -1
- package/sensor/dist/errors.d.ts +14 -0
- package/sensor/dist/errors.d.ts.map +1 -1
- package/sensor/dist/errors.js +16 -1
- package/sensor/dist/errors.js.map +1 -1
- package/sensor/dist/extraction/cfml-extractor.d.ts +1 -0
- package/sensor/dist/extraction/cfml-extractor.d.ts.map +1 -1
- package/sensor/dist/extraction/cfml-extractor.js +15 -3
- package/sensor/dist/extraction/cfml-extractor.js.map +1 -1
- package/sensor/dist/extraction/dfm-extractor.d.ts.map +1 -1
- package/sensor/dist/extraction/dfm-extractor.js +14 -10
- package/sensor/dist/extraction/dfm-extractor.js.map +1 -1
- package/sensor/dist/extraction/extraction-version.d.ts +1 -1
- package/sensor/dist/extraction/extraction-version.d.ts.map +1 -1
- package/sensor/dist/extraction/extraction-version.js +3 -1
- package/sensor/dist/extraction/extraction-version.js.map +1 -1
- package/sensor/dist/extraction/function-ref.d.ts +6 -4
- package/sensor/dist/extraction/function-ref.d.ts.map +1 -1
- package/sensor/dist/extraction/function-ref.js +35 -14
- package/sensor/dist/extraction/function-ref.js.map +1 -1
- package/sensor/dist/extraction/generated-detection.d.ts +48 -12
- package/sensor/dist/extraction/generated-detection.d.ts.map +1 -1
- package/sensor/dist/extraction/generated-detection.js +176 -11
- package/sensor/dist/extraction/generated-detection.js.map +1 -1
- package/sensor/dist/extraction/grammars.d.ts +38 -0
- package/sensor/dist/extraction/grammars.d.ts.map +1 -1
- package/sensor/dist/extraction/grammars.js +115 -3
- package/sensor/dist/extraction/grammars.js.map +1 -1
- package/sensor/dist/extraction/index.d.ts +218 -14
- package/sensor/dist/extraction/index.d.ts.map +1 -1
- package/sensor/dist/extraction/index.js +887 -175
- package/sensor/dist/extraction/index.js.map +1 -1
- package/sensor/dist/extraction/languages/c-cpp.d.ts +58 -0
- package/sensor/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/c-cpp.js +310 -19
- package/sensor/dist/extraction/languages/c-cpp.js.map +1 -1
- package/sensor/dist/extraction/languages/dart.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/dart.js +8 -3
- package/sensor/dist/extraction/languages/dart.js.map +1 -1
- package/sensor/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/erlang.js +58 -22
- package/sensor/dist/extraction/languages/erlang.js.map +1 -1
- package/sensor/dist/extraction/languages/javascript.js +1 -1
- package/sensor/dist/extraction/languages/javascript.js.map +1 -1
- package/sensor/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/kotlin.js +169 -36
- package/sensor/dist/extraction/languages/kotlin.js.map +1 -1
- package/sensor/dist/extraction/languages/lua.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/lua.js +4 -1
- package/sensor/dist/extraction/languages/lua.js.map +1 -1
- package/sensor/dist/extraction/languages/objc.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/objc.js +4 -0
- package/sensor/dist/extraction/languages/objc.js.map +1 -1
- package/sensor/dist/extraction/languages/python.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/python.js +71 -0
- package/sensor/dist/extraction/languages/python.js.map +1 -1
- package/sensor/dist/extraction/languages/rust.d.ts +20 -0
- package/sensor/dist/extraction/languages/rust.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/rust.js +50 -20
- package/sensor/dist/extraction/languages/rust.js.map +1 -1
- package/sensor/dist/extraction/languages/scala.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/scala.js +18 -3
- package/sensor/dist/extraction/languages/scala.js.map +1 -1
- package/sensor/dist/extraction/languages/swift.d.ts +15 -0
- package/sensor/dist/extraction/languages/swift.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/swift.js +50 -0
- package/sensor/dist/extraction/languages/swift.js.map +1 -1
- package/sensor/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/sensor/dist/extraction/languages/typescript.js +9 -2
- package/sensor/dist/extraction/languages/typescript.js.map +1 -1
- package/sensor/dist/extraction/liquid-extractor.d.ts +18 -0
- package/sensor/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/sensor/dist/extraction/liquid-extractor.js +98 -22
- package/sensor/dist/extraction/liquid-extractor.js.map +1 -1
- package/sensor/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/sensor/dist/extraction/mybatis-extractor.js +6 -4
- package/sensor/dist/extraction/mybatis-extractor.js.map +1 -1
- package/sensor/dist/extraction/parse-pool.d.ts +7 -0
- package/sensor/dist/extraction/parse-pool.d.ts.map +1 -1
- package/sensor/dist/extraction/parse-pool.js +20 -1
- package/sensor/dist/extraction/parse-pool.js.map +1 -1
- package/sensor/dist/extraction/syntax-tokens.d.ts +103 -0
- package/sensor/dist/extraction/syntax-tokens.d.ts.map +1 -0
- package/sensor/dist/extraction/syntax-tokens.js +381 -0
- package/sensor/dist/extraction/syntax-tokens.js.map +1 -0
- package/sensor/dist/extraction/tree-sitter-helpers.d.ts +5 -0
- package/sensor/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/sensor/dist/extraction/tree-sitter-helpers.js +17 -0
- package/sensor/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/sensor/dist/extraction/tree-sitter-types.d.ts +31 -3
- package/sensor/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/sensor/dist/extraction/tree-sitter.d.ts +101 -18
- package/sensor/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/sensor/dist/extraction/tree-sitter.js +928 -134
- package/sensor/dist/extraction/tree-sitter.js.map +1 -1
- package/sensor/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/sensor/dist/file-limits.d.ts +40 -0
- package/sensor/dist/file-limits.d.ts.map +1 -0
- package/sensor/dist/file-limits.js +147 -0
- package/sensor/dist/file-limits.js.map +1 -0
- package/sensor/dist/graph/branch-guards.d.ts +265 -0
- package/sensor/dist/graph/branch-guards.d.ts.map +1 -0
- package/sensor/dist/graph/branch-guards.js +2325 -0
- package/sensor/dist/graph/branch-guards.js.map +1 -0
- package/sensor/dist/graph/dead-code.d.ts +251 -0
- package/sensor/dist/graph/dead-code.d.ts.map +1 -0
- package/sensor/dist/graph/dead-code.js +776 -0
- package/sensor/dist/graph/dead-code.js.map +1 -0
- package/sensor/dist/graph/dynamic-boundary-report.d.ts +121 -0
- package/sensor/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
- package/sensor/dist/graph/dynamic-boundary-report.js +283 -0
- package/sensor/dist/graph/dynamic-boundary-report.js.map +1 -0
- package/sensor/dist/graph/index.d.ts +4 -0
- package/sensor/dist/graph/index.d.ts.map +1 -1
- package/sensor/dist/graph/index.js +16 -1
- package/sensor/dist/graph/index.js.map +1 -1
- package/sensor/dist/graph/named-symbol-flow.d.ts +125 -0
- package/sensor/dist/graph/named-symbol-flow.d.ts.map +1 -0
- package/sensor/dist/graph/named-symbol-flow.js +552 -0
- package/sensor/dist/graph/named-symbol-flow.js.map +1 -0
- package/sensor/dist/graph/queries.d.ts.map +1 -1
- package/sensor/dist/graph/queries.js +2 -0
- package/sensor/dist/graph/queries.js.map +1 -1
- package/sensor/dist/graph/symbol-lookup.d.ts +83 -0
- package/sensor/dist/graph/symbol-lookup.d.ts.map +1 -0
- package/sensor/dist/graph/symbol-lookup.js +181 -0
- package/sensor/dist/graph/symbol-lookup.js.map +1 -0
- package/sensor/dist/graph/traversal.d.ts +9 -0
- package/sensor/dist/graph/traversal.d.ts.map +1 -1
- package/sensor/dist/graph/traversal.js +62 -36
- package/sensor/dist/graph/traversal.js.map +1 -1
- package/sensor/dist/graph/type-hierarchy.d.ts +155 -0
- package/sensor/dist/graph/type-hierarchy.d.ts.map +1 -0
- package/sensor/dist/graph/type-hierarchy.js +382 -0
- package/sensor/dist/graph/type-hierarchy.js.map +1 -0
- package/sensor/dist/index.d.ts +272 -10
- package/sensor/dist/index.d.ts.map +1 -1
- package/sensor/dist/index.js +510 -34
- package/sensor/dist/index.js.map +1 -1
- package/sensor/dist/mcp/answer-freshness.d.ts +10 -0
- package/sensor/dist/mcp/answer-freshness.d.ts.map +1 -0
- package/sensor/dist/mcp/answer-freshness.js +68 -0
- package/sensor/dist/mcp/answer-freshness.js.map +1 -0
- package/sensor/dist/mcp/daemon-manager.d.ts +1 -1
- package/sensor/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon-manager.js +17 -1
- package/sensor/dist/mcp/daemon-manager.js.map +1 -1
- package/sensor/dist/mcp/daemon-paths.d.ts +8 -0
- package/sensor/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon-paths.js +65 -2
- package/sensor/dist/mcp/daemon-paths.js.map +1 -1
- package/sensor/dist/mcp/daemon-registry.d.ts +17 -4
- package/sensor/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon-registry.js +133 -23
- package/sensor/dist/mcp/daemon-registry.js.map +1 -1
- package/sensor/dist/mcp/daemon.d.ts +26 -13
- package/sensor/dist/mcp/daemon.d.ts.map +1 -1
- package/sensor/dist/mcp/daemon.js +126 -32
- package/sensor/dist/mcp/daemon.js.map +1 -1
- package/sensor/dist/mcp/dynamic-boundaries.d.ts +1 -10
- package/sensor/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/sensor/dist/mcp/dynamic-boundaries.js +46 -42
- package/sensor/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/sensor/dist/mcp/engine.d.ts +31 -9
- package/sensor/dist/mcp/engine.d.ts.map +1 -1
- package/sensor/dist/mcp/engine.js +190 -79
- package/sensor/dist/mcp/engine.js.map +1 -1
- package/sensor/dist/mcp/explore-dedup.d.ts +140 -0
- package/sensor/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/sensor/dist/mcp/explore-dedup.js +239 -0
- package/sensor/dist/mcp/explore-dedup.js.map +1 -0
- package/sensor/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/sensor/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/sensor/dist/mcp/explore-diagnostics.js +558 -0
- package/sensor/dist/mcp/explore-diagnostics.js.map +1 -0
- package/sensor/dist/mcp/explore-session-state.d.ts +217 -0
- package/sensor/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/sensor/dist/mcp/explore-session-state.js +322 -0
- package/sensor/dist/mcp/explore-session-state.js.map +1 -0
- package/sensor/dist/mcp/index-freshness-worker.d.ts +2 -0
- package/sensor/dist/mcp/index-freshness-worker.d.ts.map +1 -0
- package/sensor/dist/mcp/index-freshness-worker.js +30 -0
- package/sensor/dist/mcp/index-freshness-worker.js.map +1 -0
- package/sensor/dist/mcp/index-freshness.d.ts +7 -0
- package/sensor/dist/mcp/index-freshness.d.ts.map +1 -0
- package/sensor/dist/mcp/index-freshness.js +94 -0
- package/sensor/dist/mcp/index-freshness.js.map +1 -0
- package/sensor/dist/mcp/index.d.ts +3 -1
- package/sensor/dist/mcp/index.d.ts.map +1 -1
- package/sensor/dist/mcp/index.js +109 -12
- package/sensor/dist/mcp/index.js.map +1 -1
- package/sensor/dist/mcp/liveness-watchdog.d.ts +4 -1
- package/sensor/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/sensor/dist/mcp/liveness-watchdog.js +11 -2
- package/sensor/dist/mcp/liveness-watchdog.js.map +1 -1
- package/sensor/dist/mcp/project-lifecycle.d.ts +9 -0
- package/sensor/dist/mcp/project-lifecycle.d.ts.map +1 -0
- package/sensor/dist/mcp/project-lifecycle.js +182 -0
- package/sensor/dist/mcp/project-lifecycle.js.map +1 -0
- package/sensor/dist/mcp/proxy.d.ts.map +1 -1
- package/sensor/dist/mcp/proxy.js +15 -1
- package/sensor/dist/mcp/proxy.js.map +1 -1
- package/sensor/dist/mcp/query-pool.d.ts +2 -2
- package/sensor/dist/mcp/query-pool.d.ts.map +1 -1
- package/sensor/dist/mcp/query-pool.js +9 -7
- package/sensor/dist/mcp/query-pool.js.map +1 -1
- package/sensor/dist/mcp/query-worker.js +2 -2
- package/sensor/dist/mcp/query-worker.js.map +1 -1
- package/sensor/dist/mcp/server-instructions.d.ts +2 -2
- package/sensor/dist/mcp/server-instructions.d.ts.map +1 -1
- package/sensor/dist/mcp/server-instructions.js +13 -6
- package/sensor/dist/mcp/server-instructions.js.map +1 -1
- package/sensor/dist/mcp/session.d.ts +16 -0
- package/sensor/dist/mcp/session.d.ts.map +1 -1
- package/sensor/dist/mcp/session.js +36 -13
- package/sensor/dist/mcp/session.js.map +1 -1
- package/sensor/dist/mcp/startup-handshake.d.ts +3 -1
- package/sensor/dist/mcp/startup-handshake.d.ts.map +1 -1
- package/sensor/dist/mcp/startup-handshake.js +10 -2
- package/sensor/dist/mcp/startup-handshake.js.map +1 -1
- package/sensor/dist/mcp/tools.d.ts +496 -38
- package/sensor/dist/mcp/tools.d.ts.map +1 -1
- package/sensor/dist/mcp/tools.js +4021 -772
- package/sensor/dist/mcp/tools.js.map +1 -1
- package/sensor/dist/mcp/writer-lock.d.ts +61 -0
- package/sensor/dist/mcp/writer-lock.d.ts.map +1 -0
- package/sensor/dist/mcp/writer-lock.js +260 -0
- package/sensor/dist/mcp/writer-lock.js.map +1 -0
- package/sensor/dist/project-config.d.ts +23 -0
- package/sensor/dist/project-config.d.ts.map +1 -1
- package/sensor/dist/project-config.js +39 -2
- package/sensor/dist/project-config.js.map +1 -1
- package/sensor/dist/resolution/alias-binding.d.ts +56 -0
- package/sensor/dist/resolution/alias-binding.d.ts.map +1 -0
- package/sensor/dist/resolution/alias-binding.js +127 -0
- package/sensor/dist/resolution/alias-binding.js.map +1 -0
- package/sensor/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/sensor/dist/resolution/c-fnptr-synthesizer.js +21 -19
- package/sensor/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/sensor/dist/resolution/callback-synthesizer.d.ts +23 -1
- package/sensor/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/sensor/dist/resolution/callback-synthesizer.js +356 -155
- package/sensor/dist/resolution/callback-synthesizer.js.map +1 -1
- package/sensor/dist/resolution/cpp-constructor.d.ts +4 -0
- package/sensor/dist/resolution/cpp-constructor.d.ts.map +1 -0
- package/sensor/dist/resolution/cpp-constructor.js +123 -0
- package/sensor/dist/resolution/cpp-constructor.js.map +1 -0
- package/sensor/dist/resolution/cpp-macro-visibility.d.ts +12 -0
- package/sensor/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
- package/sensor/dist/resolution/cpp-macro-visibility.js +342 -0
- package/sensor/dist/resolution/cpp-macro-visibility.js.map +1 -0
- package/sensor/dist/resolution/expo-router-synthesizer.d.ts +32 -0
- package/sensor/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/expo-router-synthesizer.js +189 -0
- package/sensor/dist/resolution/expo-router-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/csharp.js +96 -2
- package/sensor/dist/resolution/frameworks/csharp.js.map +1 -1
- package/sensor/dist/resolution/frameworks/expo-router.d.ts +189 -0
- package/sensor/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/expo-router.js +785 -0
- package/sensor/dist/resolution/frameworks/expo-router.js.map +1 -0
- package/sensor/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/express.js +251 -16
- package/sensor/dist/resolution/frameworks/express.js.map +1 -1
- package/sensor/dist/resolution/frameworks/index.d.ts +5 -0
- package/sensor/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/index.js +29 -1
- package/sensor/dist/resolution/frameworks/index.js.map +1 -1
- package/sensor/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/java.js +79 -47
- package/sensor/dist/resolution/frameworks/java.js.map +1 -1
- package/sensor/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/laravel.js +294 -4
- package/sensor/dist/resolution/frameworks/laravel.js.map +1 -1
- package/sensor/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/nestjs.js +6 -14
- package/sensor/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/sensor/dist/resolution/frameworks/nextjs.d.ts +76 -0
- package/sensor/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/nextjs.js +328 -0
- package/sensor/dist/resolution/frameworks/nextjs.js.map +1 -0
- package/sensor/dist/resolution/frameworks/object-literal.d.ts +32 -0
- package/sensor/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/object-literal.js +139 -0
- package/sensor/dist/resolution/frameworks/object-literal.js.map +1 -0
- package/sensor/dist/resolution/frameworks/package-deps.d.ts +14 -0
- package/sensor/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/package-deps.js +78 -0
- package/sensor/dist/resolution/frameworks/package-deps.js.map +1 -0
- package/sensor/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/python.js +166 -0
- package/sensor/dist/resolution/frameworks/python.js.map +1 -1
- package/sensor/dist/resolution/frameworks/react-native.d.ts +26 -0
- package/sensor/dist/resolution/frameworks/react-native.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/react-native.js +153 -14
- package/sensor/dist/resolution/frameworks/react-native.js.map +1 -1
- package/sensor/dist/resolution/frameworks/react-router.d.ts +46 -0
- package/sensor/dist/resolution/frameworks/react-router.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/react-router.js +187 -0
- package/sensor/dist/resolution/frameworks/react-router.js.map +1 -0
- package/sensor/dist/resolution/frameworks/react.d.ts +2 -1
- package/sensor/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/react.js +188 -139
- package/sensor/dist/resolution/frameworks/react.js.map +1 -1
- package/sensor/dist/resolution/frameworks/svelte.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/svelte.js +6 -1
- package/sensor/dist/resolution/frameworks/svelte.js.map +1 -1
- package/sensor/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
- package/sensor/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/sveltekit-router.js +156 -0
- package/sensor/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
- package/sensor/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/sensor/dist/resolution/frameworks/swift.js +140 -99
- package/sensor/dist/resolution/frameworks/swift.js.map +1 -1
- package/sensor/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
- package/sensor/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/tanstack-router.js +437 -0
- package/sensor/dist/resolution/frameworks/tanstack-router.js.map +1 -0
- package/sensor/dist/resolution/frameworks/vue-router.d.ts +82 -0
- package/sensor/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
- package/sensor/dist/resolution/frameworks/vue-router.js +377 -0
- package/sensor/dist/resolution/frameworks/vue-router.js.map +1 -0
- package/sensor/dist/resolution/import-resolver.d.ts +38 -0
- package/sensor/dist/resolution/import-resolver.d.ts.map +1 -1
- package/sensor/dist/resolution/import-resolver.js +394 -28
- package/sensor/dist/resolution/import-resolver.js.map +1 -1
- package/sensor/dist/resolution/index.d.ts +89 -25
- package/sensor/dist/resolution/index.d.ts.map +1 -1
- package/sensor/dist/resolution/index.js +573 -148
- package/sensor/dist/resolution/index.js.map +1 -1
- package/sensor/dist/resolution/js-builtins.d.ts +13 -0
- package/sensor/dist/resolution/js-builtins.d.ts.map +1 -0
- package/sensor/dist/resolution/js-builtins.js +46 -0
- package/sensor/dist/resolution/js-builtins.js.map +1 -0
- package/sensor/dist/resolution/name-matcher.d.ts +99 -22
- package/sensor/dist/resolution/name-matcher.d.ts.map +1 -1
- package/sensor/dist/resolution/name-matcher.js +2220 -86
- package/sensor/dist/resolution/name-matcher.js.map +1 -1
- package/sensor/dist/resolution/next-router-synthesizer.d.ts +27 -0
- package/sensor/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/next-router-synthesizer.js +113 -0
- package/sensor/dist/resolution/next-router-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/path-aliases.d.ts +6 -4
- package/sensor/dist/resolution/path-aliases.d.ts.map +1 -1
- package/sensor/dist/resolution/path-aliases.js +125 -17
- package/sensor/dist/resolution/path-aliases.js.map +1 -1
- package/sensor/dist/resolution/react-router-synthesizer.d.ts +33 -0
- package/sensor/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/react-router-synthesizer.js +126 -0
- package/sensor/dist/resolution/react-router-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/resolver-pool.d.ts +2 -0
- package/sensor/dist/resolution/resolver-pool.d.ts.map +1 -1
- package/sensor/dist/resolution/resolver-pool.js +4 -0
- package/sensor/dist/resolution/resolver-pool.js.map +1 -1
- package/sensor/dist/resolution/strip-comments.d.ts +6 -0
- package/sensor/dist/resolution/strip-comments.d.ts.map +1 -1
- package/sensor/dist/resolution/strip-comments.js +58 -0
- package/sensor/dist/resolution/strip-comments.js.map +1 -1
- package/sensor/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
- package/sensor/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/sveltekit-synthesizer.js +173 -0
- package/sensor/dist/resolution/sveltekit-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/swift-type-visibility.d.ts +52 -0
- package/sensor/dist/resolution/swift-type-visibility.d.ts.map +1 -0
- package/sensor/dist/resolution/swift-type-visibility.js +328 -0
- package/sensor/dist/resolution/swift-type-visibility.js.map +1 -0
- package/sensor/dist/resolution/synth-utils.d.ts +26 -0
- package/sensor/dist/resolution/synth-utils.d.ts.map +1 -0
- package/sensor/dist/resolution/synth-utils.js +75 -0
- package/sensor/dist/resolution/synth-utils.js.map +1 -0
- package/sensor/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
- package/sensor/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/tanstack-router-synthesizer.js +114 -0
- package/sensor/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/tier-synthesizer.d.ts +54 -0
- package/sensor/dist/resolution/tier-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/tier-synthesizer.js +1294 -0
- package/sensor/dist/resolution/tier-synthesizer.js.map +1 -0
- package/sensor/dist/resolution/types.d.ts +78 -2
- package/sensor/dist/resolution/types.d.ts.map +1 -1
- package/sensor/dist/resolution/types.js +64 -0
- package/sensor/dist/resolution/types.js.map +1 -1
- package/sensor/dist/resolution/vue-router-synthesizer.d.ts +30 -0
- package/sensor/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
- package/sensor/dist/resolution/vue-router-synthesizer.js +115 -0
- package/sensor/dist/resolution/vue-router-synthesizer.js.map +1 -0
- package/sensor/dist/search/identifier-segments.d.ts +10 -0
- package/sensor/dist/search/identifier-segments.d.ts.map +1 -1
- package/sensor/dist/search/identifier-segments.js +29 -0
- package/sensor/dist/search/identifier-segments.js.map +1 -1
- package/sensor/dist/search/query-paths.d.ts +106 -0
- package/sensor/dist/search/query-paths.d.ts.map +1 -0
- package/sensor/dist/search/query-paths.js +513 -0
- package/sensor/dist/search/query-paths.js.map +1 -0
- package/sensor/dist/search/query-utils.d.ts +22 -2
- package/sensor/dist/search/query-utils.d.ts.map +1 -1
- package/sensor/dist/search/query-utils.js +56 -16
- package/sensor/dist/search/query-utils.js.map +1 -1
- package/sensor/dist/sync/watch-policy.d.ts +14 -0
- package/sensor/dist/sync/watch-policy.d.ts.map +1 -1
- package/sensor/dist/sync/watch-policy.js +19 -0
- package/sensor/dist/sync/watch-policy.js.map +1 -1
- package/sensor/dist/sync/watcher.d.ts +74 -35
- package/sensor/dist/sync/watcher.d.ts.map +1 -1
- package/sensor/dist/sync/watcher.js +281 -99
- package/sensor/dist/sync/watcher.js.map +1 -1
- package/sensor/dist/telemetry/index.d.ts +4 -2
- package/sensor/dist/telemetry/index.d.ts.map +1 -1
- package/sensor/dist/telemetry/index.js +92 -41
- package/sensor/dist/telemetry/index.js.map +1 -1
- package/sensor/dist/types.d.ts +18 -2
- package/sensor/dist/types.d.ts.map +1 -1
- package/sensor/dist/types.js +2 -0
- package/sensor/dist/types.js.map +1 -1
- package/sensor/dist/ui-server/api/deadcode.d.ts +84 -0
- package/sensor/dist/ui-server/api/deadcode.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/deadcode.js +136 -0
- package/sensor/dist/ui-server/api/deadcode.js.map +1 -0
- package/sensor/dist/ui-server/api/effects.d.ts +94 -0
- package/sensor/dist/ui-server/api/effects.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/effects.js +527 -0
- package/sensor/dist/ui-server/api/effects.js.map +1 -0
- package/sensor/dist/ui-server/api/entrypoints.d.ts +92 -0
- package/sensor/dist/ui-server/api/entrypoints.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/entrypoints.js +361 -0
- package/sensor/dist/ui-server/api/entrypoints.js.map +1 -0
- package/sensor/dist/ui-server/api/events.d.ts +183 -0
- package/sensor/dist/ui-server/api/events.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/events.js +430 -0
- package/sensor/dist/ui-server/api/events.js.map +1 -0
- package/sensor/dist/ui-server/api/file.d.ts +66 -0
- package/sensor/dist/ui-server/api/file.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/file.js +235 -0
- package/sensor/dist/ui-server/api/file.js.map +1 -0
- package/sensor/dist/ui-server/api/filecode.d.ts +126 -0
- package/sensor/dist/ui-server/api/filecode.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/filecode.js +205 -0
- package/sensor/dist/ui-server/api/filecode.js.map +1 -0
- package/sensor/dist/ui-server/api/flow.d.ts +226 -0
- package/sensor/dist/ui-server/api/flow.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/flow.js +612 -0
- package/sensor/dist/ui-server/api/flow.js.map +1 -0
- package/sensor/dist/ui-server/api/hierarchy.d.ts +81 -0
- package/sensor/dist/ui-server/api/hierarchy.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/hierarchy.js +92 -0
- package/sensor/dist/ui-server/api/hierarchy.js.map +1 -0
- package/sensor/dist/ui-server/api/index.d.ts +90 -0
- package/sensor/dist/ui-server/api/index.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/index.js +332 -0
- package/sensor/dist/ui-server/api/index.js.map +1 -0
- package/sensor/dist/ui-server/api/map.d.ts +256 -0
- package/sensor/dist/ui-server/api/map.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/map.js +760 -0
- package/sensor/dist/ui-server/api/map.js.map +1 -0
- package/sensor/dist/ui-server/api/node.d.ts +81 -0
- package/sensor/dist/ui-server/api/node.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/node.js +388 -0
- package/sensor/dist/ui-server/api/node.js.map +1 -0
- package/sensor/dist/ui-server/api/nodes.d.ts +25 -0
- package/sensor/dist/ui-server/api/nodes.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/nodes.js +45 -0
- package/sensor/dist/ui-server/api/nodes.js.map +1 -0
- package/sensor/dist/ui-server/api/program.d.ts +139 -0
- package/sensor/dist/ui-server/api/program.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/program.js +315 -0
- package/sensor/dist/ui-server/api/program.js.map +1 -0
- package/sensor/dist/ui-server/api/respond.d.ts +76 -0
- package/sensor/dist/ui-server/api/respond.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/respond.js +186 -0
- package/sensor/dist/ui-server/api/respond.js.map +1 -0
- package/sensor/dist/ui-server/api/route-roots.d.ts +39 -0
- package/sensor/dist/ui-server/api/route-roots.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/route-roots.js +96 -0
- package/sensor/dist/ui-server/api/route-roots.js.map +1 -0
- package/sensor/dist/ui-server/api/routes.d.ts +59 -0
- package/sensor/dist/ui-server/api/routes.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/routes.js +108 -0
- package/sensor/dist/ui-server/api/routes.js.map +1 -0
- package/sensor/dist/ui-server/api/screens.d.ts +117 -0
- package/sensor/dist/ui-server/api/screens.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/screens.js +611 -0
- package/sensor/dist/ui-server/api/screens.js.map +1 -0
- package/sensor/dist/ui-server/api/search.d.ts +29 -0
- package/sensor/dist/ui-server/api/search.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/search.js +232 -0
- package/sensor/dist/ui-server/api/search.js.map +1 -0
- package/sensor/dist/ui-server/api/session.d.ts +52 -0
- package/sensor/dist/ui-server/api/session.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/session.js +196 -0
- package/sensor/dist/ui-server/api/session.js.map +1 -0
- package/sensor/dist/ui-server/api/source.d.ts +200 -0
- package/sensor/dist/ui-server/api/source.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/source.js +422 -0
- package/sensor/dist/ui-server/api/source.js.map +1 -0
- package/sensor/dist/ui-server/api/stats.d.ts +27 -0
- package/sensor/dist/ui-server/api/stats.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/stats.js +164 -0
- package/sensor/dist/ui-server/api/stats.js.map +1 -0
- package/sensor/dist/ui-server/api/steps.d.ts +274 -0
- package/sensor/dist/ui-server/api/steps.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/steps.js +1544 -0
- package/sensor/dist/ui-server/api/steps.js.map +1 -0
- package/sensor/dist/ui-server/api/trail-store.d.ts +142 -0
- package/sensor/dist/ui-server/api/trail-store.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/trail-store.js +325 -0
- package/sensor/dist/ui-server/api/trail-store.js.map +1 -0
- package/sensor/dist/ui-server/api/trails.d.ts +163 -0
- package/sensor/dist/ui-server/api/trails.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/trails.js +369 -0
- package/sensor/dist/ui-server/api/trails.js.map +1 -0
- package/sensor/dist/ui-server/api/when.d.ts +133 -0
- package/sensor/dist/ui-server/api/when.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/when.js +275 -0
- package/sensor/dist/ui-server/api/when.js.map +1 -0
- package/sensor/dist/ui-server/api/wire.d.ts +179 -0
- package/sensor/dist/ui-server/api/wire.d.ts.map +1 -0
- package/sensor/dist/ui-server/api/wire.js +231 -0
- package/sensor/dist/ui-server/api/wire.js.map +1 -0
- package/sensor/dist/ui-server/assets.d.ts +40 -0
- package/sensor/dist/ui-server/assets.d.ts.map +1 -0
- package/sensor/dist/ui-server/assets.js +110 -0
- package/sensor/dist/ui-server/assets.js.map +1 -0
- package/sensor/dist/ui-server/constants.d.ts +32 -0
- package/sensor/dist/ui-server/constants.d.ts.map +1 -0
- package/sensor/dist/ui-server/constants.js +35 -0
- package/sensor/dist/ui-server/constants.js.map +1 -0
- package/sensor/dist/ui-server/highlight/index.d.ts +113 -0
- package/sensor/dist/ui-server/highlight/index.d.ts.map +1 -0
- package/sensor/dist/ui-server/highlight/index.js +307 -0
- package/sensor/dist/ui-server/highlight/index.js.map +1 -0
- package/sensor/dist/ui-server/highlight/languages.d.ts +36 -0
- package/sensor/dist/ui-server/highlight/languages.d.ts.map +1 -0
- package/sensor/dist/ui-server/highlight/languages.js +50 -0
- package/sensor/dist/ui-server/highlight/languages.js.map +1 -0
- package/sensor/dist/ui-server/index.d.ts +92 -0
- package/sensor/dist/ui-server/index.d.ts.map +1 -0
- package/sensor/dist/ui-server/index.js +399 -0
- package/sensor/dist/ui-server/index.js.map +1 -0
- package/sensor/dist/ui-server/open-browser.d.ts +31 -0
- package/sensor/dist/ui-server/open-browser.d.ts.map +1 -0
- package/sensor/dist/ui-server/open-browser.js +79 -0
- package/sensor/dist/ui-server/open-browser.js.map +1 -0
- package/sensor/dist/ui-server/security.d.ts +127 -0
- package/sensor/dist/ui-server/security.d.ts.map +1 -0
- package/sensor/dist/ui-server/security.js +332 -0
- package/sensor/dist/ui-server/security.js.map +1 -0
- package/sensor/dist/ui-server/static.d.ts +45 -0
- package/sensor/dist/ui-server/static.d.ts.map +1 -0
- package/sensor/dist/ui-server/static.js +165 -0
- package/sensor/dist/ui-server/static.js.map +1 -0
- package/sensor/dist/utils.d.ts +14 -2
- package/sensor/dist/utils.d.ts.map +1 -1
- package/sensor/dist/utils.js +25 -10
- package/sensor/dist/utils.js.map +1 -1
- package/src/cli-help.mjs +4 -2
- package/src/sensor-adapter.mjs +5 -1
- package/src/todo-cli.mjs +88 -11
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cppExtractor = exports.cExtractor = void 0;
|
|
4
4
|
exports.normalizeCppReturnType = normalizeCppReturnType;
|
|
5
5
|
exports.stripCppTemplateArgs = stripCppTemplateArgs;
|
|
6
|
+
exports.isCppPureVirtualMethodDecl = isCppPureVirtualMethodDecl;
|
|
6
7
|
exports.blankCppExportMacros = blankCppExportMacros;
|
|
7
8
|
exports.blankCppInlineMacros = blankCppInlineMacros;
|
|
8
9
|
exports.recoverMangledCppName = recoverMangledCppName;
|
|
9
10
|
exports.blankMetalAttributes = blankMetalAttributes;
|
|
11
|
+
exports.maskCppRawStrings = maskCppRawStrings;
|
|
10
12
|
exports.blankCppAnnotationMacroCalls = blankCppAnnotationMacroCalls;
|
|
11
13
|
exports.blankLoneMacroLines = blankLoneMacroLines;
|
|
12
14
|
exports.blankCppApiPrefixMacros = blankCppApiPrefixMacros;
|
|
@@ -25,6 +27,8 @@ exports.blankCFileScopePrefixedDeclMacros = blankCFileScopePrefixedDeclMacros;
|
|
|
25
27
|
exports.rewriteCPrefixedDeclMacroInitializers = rewriteCPrefixedDeclMacroInitializers;
|
|
26
28
|
exports.blankCVaArgQualifiedTypeArgs = blankCVaArgQualifiedTypeArgs;
|
|
27
29
|
exports.blankCNamedVariadicDefineDots = blankCNamedVariadicDefineDots;
|
|
30
|
+
exports.blankCDesignatedMacroArgs = blankCDesignatedMacroArgs;
|
|
31
|
+
exports.isCppConstructorDeclaration = isCppConstructorDeclaration;
|
|
28
32
|
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
29
33
|
/**
|
|
30
34
|
* Find the function NAME's `qualified_identifier` (`Foo::bar`) inside a
|
|
@@ -51,6 +55,67 @@ function findDeclaratorQualifiedId(declarator) {
|
|
|
51
55
|
}
|
|
52
56
|
return undefined;
|
|
53
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Single-argument macros are ambiguous without their definition (#1373).
|
|
60
|
+
* Require a preceding local #define whose replacement uses its sole parameter
|
|
61
|
+
* as the function declarator; registration, token-pasting, and K&R forms stay
|
|
62
|
+
* untouched. Walk enclosing scopes, but never guess across conditional macros.
|
|
63
|
+
*/
|
|
64
|
+
function recoverSingleArgMacroDefinedName(node, source) {
|
|
65
|
+
if (node.type !== 'function_definition')
|
|
66
|
+
return undefined;
|
|
67
|
+
const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
68
|
+
let macro = null;
|
|
69
|
+
let argument = null;
|
|
70
|
+
if (declarator?.type === 'parenthesized_declarator' && declarator.namedChildCount === 1) {
|
|
71
|
+
// C: NATIVE_FN is parsed as the return type, (name) as the declarator.
|
|
72
|
+
macro = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
73
|
+
argument = declarator.namedChild(0);
|
|
74
|
+
if (macro?.type !== 'type_identifier' || argument?.type !== 'identifier')
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
else if (declarator?.type === 'function_declarator' && !(0, tree_sitter_helpers_1.getChildByField)(node, 'type')) {
|
|
78
|
+
// C++: NATIVE_FN(name) is parsed as an implicit-return-type function.
|
|
79
|
+
macro = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'declarator');
|
|
80
|
+
const params = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'parameters');
|
|
81
|
+
const param = params?.namedChild(0);
|
|
82
|
+
if (macro?.type !== 'identifier' || params?.namedChildCount !== 1 ||
|
|
83
|
+
param?.type !== 'parameter_declaration' || param.namedChildCount !== 1)
|
|
84
|
+
return undefined;
|
|
85
|
+
argument = param.namedChild(0);
|
|
86
|
+
if (argument?.type !== 'type_identifier')
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
if (!macro || !argument)
|
|
90
|
+
return undefined;
|
|
91
|
+
const macroName = (0, tree_sitter_helpers_1.getNodeText)(macro, source);
|
|
92
|
+
for (let scope = node; scope; scope = scope.parent) {
|
|
93
|
+
if (scope.type === 'preproc_else' || scope.type.startsWith('preproc_elif'))
|
|
94
|
+
return undefined;
|
|
95
|
+
for (let prev = scope.previousNamedSibling; prev; prev = prev.previousNamedSibling) {
|
|
96
|
+
if (prev.type.startsWith('preproc_if'))
|
|
97
|
+
return undefined;
|
|
98
|
+
if (prev.type === 'preproc_call' && (0, tree_sitter_helpers_1.getChildByField)(prev, 'directive')?.text === '#undef' &&
|
|
99
|
+
(0, tree_sitter_helpers_1.getChildByField)(prev, 'argument')?.text.trim() === macroName)
|
|
100
|
+
return undefined;
|
|
101
|
+
if (prev.type !== 'preproc_function_def' && prev.type !== 'preproc_def')
|
|
102
|
+
continue;
|
|
103
|
+
if ((0, tree_sitter_helpers_1.getChildByField)(prev, 'name')?.text !== macroName)
|
|
104
|
+
continue;
|
|
105
|
+
const params = (0, tree_sitter_helpers_1.getChildByField)(prev, 'parameters');
|
|
106
|
+
const param = params?.namedChild(0);
|
|
107
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(prev, 'value');
|
|
108
|
+
if (params?.namedChildCount !== 1 || param?.type !== 'identifier' || !value)
|
|
109
|
+
return undefined;
|
|
110
|
+
const replacement = (0, tree_sitter_helpers_1.getNodeText)(value, source).replace(/\\\r?\n/g, ' ').trim();
|
|
111
|
+
const match = replacement.match(/^(?:[A-Za-z_][A-Za-z0-9_:]*\s+)+[*&\s]*([A-Za-z_]\w*)\s*\([^(){};#]*\)\s*$/);
|
|
112
|
+
if (!match || /\btypedef\b/.test(replacement) || match[1] !== param.text)
|
|
113
|
+
return undefined;
|
|
114
|
+
return (0, tree_sitter_helpers_1.getNodeText)(argument, source);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
54
119
|
/**
|
|
55
120
|
* Recover the real function name from the macro-definition idiom
|
|
56
121
|
* `MACRO_NAME(real_name, typed args…) { body }` — flash-attention's
|
|
@@ -102,7 +167,7 @@ function recoverCppMacroDefinedName(node, source) {
|
|
|
102
167
|
return name;
|
|
103
168
|
}
|
|
104
169
|
function extractCppQualifiedMethodName(node, source) {
|
|
105
|
-
const macroDefined = recoverCppMacroDefinedName(node, source);
|
|
170
|
+
const macroDefined = recoverSingleArgMacroDefinedName(node, source) ?? recoverCppMacroDefinedName(node, source);
|
|
106
171
|
if (macroDefined)
|
|
107
172
|
return macroDefined;
|
|
108
173
|
const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
@@ -208,6 +273,32 @@ function stripCppTemplateArgs(name) {
|
|
|
208
273
|
}
|
|
209
274
|
return out.trim();
|
|
210
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Is this C++ `field_declaration` a pure-virtual method (`virtual int read(int key) = 0;`)?
|
|
278
|
+
* tree-sitter-cpp shapes those as a field_declaration whose declarator unwraps to a
|
|
279
|
+
* `function_declarator`, with the pure-virtual `= 0` as a DIRECT `number_literal` "0"
|
|
280
|
+
* child of the field_declaration (default-arg `= 0` lives inside parameter_declaration
|
|
281
|
+
* and must not match). Bodiless method prototypes (`int foo();`) and data members
|
|
282
|
+
* (`int x = 0;`) are excluded — prototypes usually have an out-of-line definition that
|
|
283
|
+
* already mints the method node; pure virtuals never do (#1727).
|
|
284
|
+
*/
|
|
285
|
+
function isCppPureVirtualMethodDecl(node) {
|
|
286
|
+
if (node.type !== 'field_declaration')
|
|
287
|
+
return false;
|
|
288
|
+
let declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
289
|
+
if (!declarator)
|
|
290
|
+
return false;
|
|
291
|
+
while (declarator.type === 'pointer_declarator' ||
|
|
292
|
+
declarator.type === 'reference_declarator') {
|
|
293
|
+
const inner = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'declarator') || declarator.namedChild(0);
|
|
294
|
+
if (!inner)
|
|
295
|
+
return false;
|
|
296
|
+
declarator = inner;
|
|
297
|
+
}
|
|
298
|
+
if (declarator.type !== 'function_declarator')
|
|
299
|
+
return false;
|
|
300
|
+
return node.namedChildren.some((c) => c.type === 'number_literal' && c.text === '0');
|
|
301
|
+
}
|
|
211
302
|
/**
|
|
212
303
|
* A function/method's return type lives in the `function_definition`'s `type`
|
|
213
304
|
* field (`Metrics& Metrics::instance()` → `Metrics`). Constructors, destructors,
|
|
@@ -220,6 +311,7 @@ function extractCppReturnType(node, source) {
|
|
|
220
311
|
return normalizeCppReturnType((0, tree_sitter_helpers_1.getNodeText)(typeNode, source));
|
|
221
312
|
}
|
|
222
313
|
exports.cExtractor = {
|
|
314
|
+
resolveName: recoverSingleArgMacroDefinedName,
|
|
223
315
|
// CUDA in C-detected headers (content-gated blank; see preParseCSource).
|
|
224
316
|
preParse: preParseCSource,
|
|
225
317
|
// Universal net: recover a real name from any macro-mangled function name.
|
|
@@ -229,6 +321,9 @@ exports.cExtractor = {
|
|
|
229
321
|
methodTypes: [],
|
|
230
322
|
interfaceTypes: [],
|
|
231
323
|
structTypes: ['struct_specifier'],
|
|
324
|
+
// A bodiless `union U;` is a forward declaration; the aggregate extractor
|
|
325
|
+
// applies the same body requirement it uses for C structs.
|
|
326
|
+
unionTypes: ['union_specifier'],
|
|
232
327
|
enumTypes: ['enum_specifier'],
|
|
233
328
|
enumMemberTypes: ['enumerator'],
|
|
234
329
|
typeAliasTypes: ['type_definition'], // typedef
|
|
@@ -246,15 +341,20 @@ exports.cExtractor = {
|
|
|
246
341
|
resolveTypeAliasKind: (node, _source) => {
|
|
247
342
|
// C typedef: `typedef enum { ... } name;` or `typedef struct { ... } name;`
|
|
248
343
|
// The inner enum_specifier/struct_specifier is anonymous, but we want the typedef name
|
|
249
|
-
// to become the enum/struct node name.
|
|
344
|
+
// to become the enum/struct node name. `typedef union { ... } name;` takes the
|
|
345
|
+
// same route — otherwise the union body would mint a second, `<anonymous>` node
|
|
346
|
+
// beside the alias.
|
|
250
347
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
251
348
|
const child = node.namedChild(i);
|
|
252
349
|
if (!child)
|
|
253
350
|
continue;
|
|
254
351
|
if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
255
352
|
return 'enum';
|
|
256
|
-
if (child.type === 'struct_specifier' &&
|
|
353
|
+
if (child.type === 'struct_specifier' &&
|
|
354
|
+
(0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
257
355
|
return 'struct';
|
|
356
|
+
if (child.type === 'union_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
357
|
+
return 'union';
|
|
258
358
|
}
|
|
259
359
|
return undefined;
|
|
260
360
|
},
|
|
@@ -479,6 +579,58 @@ function blankMetalAttributes(source) {
|
|
|
479
579
|
return source;
|
|
480
580
|
return source.replace(METAL_ATTRIBUTE_RE, (m) => ' '.repeat(m.length));
|
|
481
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* Hide C++ raw literals from the offset-preserving preParse scans (#1505).
|
|
584
|
+
* Neither macro-shaped text in a raw body nor its `)delim"` closer is code.
|
|
585
|
+
* Mask the whole literal with non-whitespace, non-paren tokens, keeping line
|
|
586
|
+
* endings, so even line-based scanners treat a multiline raw argument as opaque.
|
|
587
|
+
* Restore untouched bytes afterward; a real enclosing annotation can still be
|
|
588
|
+
* removed in full. The pipeline masks once, and individual paren blankers also
|
|
589
|
+
* use this helper so they are safe when called directly.
|
|
590
|
+
*/
|
|
591
|
+
function maskCppRawStrings(source) {
|
|
592
|
+
const unchanged = { source, restore: (blanked) => blanked };
|
|
593
|
+
if (source.indexOf('R"') === -1)
|
|
594
|
+
return unchanged;
|
|
595
|
+
// Skip comments and ordinary literals before looking for a raw opener. The
|
|
596
|
+
// char-literal boundary leaves numeric digit separators (1'000) alone.
|
|
597
|
+
const re = /\/\/[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$)|\b(?:u8|[LuU])?R"([^ \t\v\f\r\n()\\]{0,16})\(|"(?:\\[\s\S]|[^"\\])*(?:"|$)|(?<!\w)(?:u8|[LuU])?'(?:\\[\s\S]|[^'\\])*(?:'|$)/g;
|
|
598
|
+
const spans = [];
|
|
599
|
+
const parts = [];
|
|
600
|
+
let last = 0;
|
|
601
|
+
let m;
|
|
602
|
+
while ((m = re.exec(source)) !== null) {
|
|
603
|
+
if (m[1] === undefined)
|
|
604
|
+
continue;
|
|
605
|
+
const closer = `)${m[1]}"`;
|
|
606
|
+
const close = source.indexOf(closer, re.lastIndex);
|
|
607
|
+
// An unterminated raw literal owns the rest of the file too.
|
|
608
|
+
const end = close < 0 ? source.length : close + closer.length;
|
|
609
|
+
spans.push({ start: m.index, end });
|
|
610
|
+
parts.push(source.slice(last, m.index), source.slice(m.index, end).replace(/[^\r\n]/g, '\0'));
|
|
611
|
+
last = re.lastIndex = end;
|
|
612
|
+
}
|
|
613
|
+
if (spans.length === 0)
|
|
614
|
+
return unchanged;
|
|
615
|
+
parts.push(source.slice(last));
|
|
616
|
+
const masked = parts.join('');
|
|
617
|
+
return {
|
|
618
|
+
source: masked,
|
|
619
|
+
restore(blanked) {
|
|
620
|
+
// A length-changing rewrite cannot be restored at the original offsets.
|
|
621
|
+
if (blanked === masked || blanked.length !== source.length)
|
|
622
|
+
return source;
|
|
623
|
+
const chars = blanked.split('');
|
|
624
|
+
for (const { start, end } of spans) {
|
|
625
|
+
for (let i = start; i < end; i++) {
|
|
626
|
+
if (chars[i] === '\0')
|
|
627
|
+
chars[i] = source[i];
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return chars.join('');
|
|
631
|
+
},
|
|
632
|
+
};
|
|
633
|
+
}
|
|
482
634
|
/**
|
|
483
635
|
* Blank annotation-style macro invocations that decorate a declaration but carry
|
|
484
636
|
* NO terminating semicolon — the pervasive Unreal-Engine reflection markup
|
|
@@ -519,6 +671,8 @@ function blankMetalAttributes(source) {
|
|
|
519
671
|
function blankCppAnnotationMacroCalls(source) {
|
|
520
672
|
if (!/^[ \t]*[A-Z][A-Z0-9_]{2,}\s*\(/m.test(source))
|
|
521
673
|
return source;
|
|
674
|
+
const rawStrings = maskCppRawStrings(source);
|
|
675
|
+
source = rawStrings.source;
|
|
522
676
|
const chars = source.split('');
|
|
523
677
|
const re = /^([ \t]*)([A-Z][A-Z0-9_]{2,})(\s*)\(/gm;
|
|
524
678
|
let m;
|
|
@@ -565,7 +719,7 @@ function blankCppAnnotationMacroCalls(source) {
|
|
|
565
719
|
}
|
|
566
720
|
re.lastIndex = end;
|
|
567
721
|
}
|
|
568
|
-
return chars.join('');
|
|
722
|
+
return rawStrings.restore(chars.join(''));
|
|
569
723
|
}
|
|
570
724
|
/**
|
|
571
725
|
* Blank a macro that is the ONLY token on its line — no parens, no semicolon:
|
|
@@ -685,6 +839,8 @@ const CPP_INLINE_ANNOTATION_RE = /\b(?:UMETA|UPARAM|UE_DEPRECATED\w*)\s*\(/g;
|
|
|
685
839
|
function blankCppInlineAnnotationMacros(source) {
|
|
686
840
|
if (!/\b(?:UMETA|UPARAM|UE_DEPRECATED)/.test(source))
|
|
687
841
|
return source;
|
|
842
|
+
const rawStrings = maskCppRawStrings(source);
|
|
843
|
+
source = rawStrings.source;
|
|
688
844
|
const chars = source.split('');
|
|
689
845
|
const re = new RegExp(CPP_INLINE_ANNOTATION_RE.source, 'g');
|
|
690
846
|
let m;
|
|
@@ -722,7 +878,7 @@ function blankCppInlineAnnotationMacros(source) {
|
|
|
722
878
|
}
|
|
723
879
|
re.lastIndex = end;
|
|
724
880
|
}
|
|
725
|
-
return chars.join('');
|
|
881
|
+
return rawStrings.restore(chars.join(''));
|
|
726
882
|
}
|
|
727
883
|
/**
|
|
728
884
|
* Blank CUDA-specific constructs before parsing `.cu`/`.cuh` files (parsed with
|
|
@@ -834,6 +990,32 @@ function restoreDirectiveLines(original, blanked) {
|
|
|
834
990
|
}
|
|
835
991
|
return changed ? b.join('\n') : blanked;
|
|
836
992
|
}
|
|
993
|
+
/** Recover MSVC's COM alias only at type-definition sites. Match on a lexical
|
|
994
|
+
* mask so comments, literals and directives cannot supply declaration evidence;
|
|
995
|
+
* replace just the keyword, preserving source offsets on both parser arms. */
|
|
996
|
+
function normalizeCppComInterfaces(source) {
|
|
997
|
+
if (!source.includes('interface'))
|
|
998
|
+
return source;
|
|
999
|
+
// Raw strings have already been masked by preParseCppSource.
|
|
1000
|
+
let code = source.replace(/\/\/(?:\\\r?\n|[^\r\n])*|\/\*[\s\S]*?(?:\*\/|$)|"(?:\\[\s\S]|[^"\\])*(?:"|$)|(?<!\w)(?:u8|[LuU])?'(?:\\[\s\S]|[^'\\])*(?:'|$)/g, (m) => m.replace(/[^\r\n]/g, ' '));
|
|
1001
|
+
const hasAlias = /^[ \t]*#[ \t]*define[ \t]+interface[ \t]+struct\b/m.test(code);
|
|
1002
|
+
code = code.replace(/^[ \t]*#(?:\\\r?\n|[^\r\n])*/gm, (m) => m.replace(/[^\r\n]/g, '\0'));
|
|
1003
|
+
const declaration = /(^|[;{}])\s*\binterface\s+[A-Za-z_]\w*\s*(:[^;{}]+)?\{/gm;
|
|
1004
|
+
const offsets = [];
|
|
1005
|
+
let match;
|
|
1006
|
+
while ((match = declaration.exec(code)) !== null) {
|
|
1007
|
+
const bodyEnd = code.indexOf('}', declaration.lastIndex);
|
|
1008
|
+
const hasVirtual = /\bvirtual\b/.test(code.slice(declaration.lastIndex, bodyEnd < 0 ? code.length : bodyEnd));
|
|
1009
|
+
if (!hasAlias && !match[2] && !hasVirtual)
|
|
1010
|
+
continue;
|
|
1011
|
+
offsets.push(match.index + match[0].indexOf('interface'));
|
|
1012
|
+
declaration.lastIndex--; // allow the opening brace to start a nested declaration
|
|
1013
|
+
}
|
|
1014
|
+
for (const offset of offsets) {
|
|
1015
|
+
source = source.slice(0, offset) + 'struct ' + source.slice(offset + 9);
|
|
1016
|
+
}
|
|
1017
|
+
return source;
|
|
1018
|
+
}
|
|
837
1019
|
/** C/C++ source pre-processing before tree-sitter: recover macro-annotated class
|
|
838
1020
|
* definitions, macro-prefixed function definitions, macro-prefixed members, and
|
|
839
1021
|
* macro-decorated members (Unreal-Engine reflection markup) — plus the non-C++
|
|
@@ -842,10 +1024,12 @@ function restoreDirectiveLines(original, blanked) {
|
|
|
842
1024
|
* or by content, for CUDA living in `.h`/`.hpp` headers). Offset-preserving;
|
|
843
1025
|
* directive lines are restored at the end (see restoreDirectiveLines). */
|
|
844
1026
|
function preParseCppSource(source, filePath) {
|
|
1027
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1028
|
+
source = rawStrings.source;
|
|
845
1029
|
// blankCLeadingAttrMacros runs AFTER the api-prefix blank so a stacked
|
|
846
1030
|
// `FMT_NORETURN FMT_API void f(…)` reduces to the `MACRO Ret name(` shape
|
|
847
1031
|
// it matches (the _API token is already spaces by then).
|
|
848
|
-
let blanked = blankLoneMacroLines(blankCLeadingAttrMacros(blankCppAnnotationMacroCalls(blankCppInlineAnnotationMacros(blankCppApiPrefixMacros(blankCppInlineMacros(blankCppExportMacros(source)))))));
|
|
1032
|
+
let blanked = blankLoneMacroLines(blankCLeadingAttrMacros(blankCppAnnotationMacroCalls(blankCppInlineAnnotationMacros(blankCppApiPrefixMacros(blankCppInlineMacros(blankCppExportMacros(normalizeCppComInterfaces(source))))))));
|
|
849
1033
|
const lower = filePath ? filePath.toLowerCase() : '';
|
|
850
1034
|
if (lower.endsWith('.metal')) {
|
|
851
1035
|
blanked = blankMetalAttributes(blanked);
|
|
@@ -853,7 +1037,7 @@ function preParseCppSource(source, filePath) {
|
|
|
853
1037
|
else if (lower.endsWith('.cu') || lower.endsWith('.cuh') || looksLikeCudaSource(source)) {
|
|
854
1038
|
blanked = blankCudaConstructs(blanked);
|
|
855
1039
|
}
|
|
856
|
-
return restoreDirectiveLines(source, blanked);
|
|
1040
|
+
return rawStrings.restore(restoreDirectiveLines(source, blanked));
|
|
857
1041
|
}
|
|
858
1042
|
/**
|
|
859
1043
|
* Blank an unknown attribute macro sitting in front of a C function
|
|
@@ -977,6 +1161,8 @@ const C_STMT_MACRO_KEYWORDS = new Set([
|
|
|
977
1161
|
'if', 'while', 'for', 'switch', 'return', 'do', 'else', 'sizeof',
|
|
978
1162
|
]);
|
|
979
1163
|
function blankCStatementMacroCalls(source) {
|
|
1164
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1165
|
+
source = rawStrings.source;
|
|
980
1166
|
const lines = source.split('\n');
|
|
981
1167
|
let changed = false;
|
|
982
1168
|
const content = (l) => l.replace(/\r$/, '').trim();
|
|
@@ -1093,7 +1279,7 @@ function blankCStatementMacroCalls(source) {
|
|
|
1093
1279
|
}
|
|
1094
1280
|
changed = true;
|
|
1095
1281
|
}
|
|
1096
|
-
return changed ? lines.join('\n') : source;
|
|
1282
|
+
return rawStrings.restore(changed ? lines.join('\n') : source);
|
|
1097
1283
|
}
|
|
1098
1284
|
/**
|
|
1099
1285
|
* Blank a lowercase compiler-annotation word SANDWICHED between a storage
|
|
@@ -1246,9 +1432,8 @@ const C_PARAM_ANNOTATION_RE = new RegExp(`\\b(${[...C_PARAMETERIZED_ANNOTATIONS]
|
|
|
1246
1432
|
function blankCParameterizedAnnotationMacros(source) {
|
|
1247
1433
|
if (source.indexOf('__') === -1)
|
|
1248
1434
|
return source;
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
return source;
|
|
1435
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1436
|
+
source = rawStrings.source;
|
|
1252
1437
|
C_PARAM_ANNOTATION_RE.lastIndex = 0;
|
|
1253
1438
|
let result = '';
|
|
1254
1439
|
let last = 0;
|
|
@@ -1269,7 +1454,7 @@ function blankCParameterizedAnnotationMacros(source) {
|
|
|
1269
1454
|
result += source.slice(last, start) + source.slice(start, end).replace(/[^\n\r]/g, ' ');
|
|
1270
1455
|
last = end;
|
|
1271
1456
|
}
|
|
1272
|
-
return result + source.slice(last);
|
|
1457
|
+
return rawStrings.restore(result + source.slice(last));
|
|
1273
1458
|
}
|
|
1274
1459
|
/**
|
|
1275
1460
|
* Blank a bare `struct`/`union`/`enum` TYPE-keyword argument inside a macro
|
|
@@ -1312,6 +1497,8 @@ const C_TYPE_ARG_SCAN_CAP = 600;
|
|
|
1312
1497
|
function blankCTypeKeywordArgs(source) {
|
|
1313
1498
|
if (!/\b(?:struct|union|enum)[ \t\r\n]/.test(source))
|
|
1314
1499
|
return source;
|
|
1500
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1501
|
+
source = rawStrings.source;
|
|
1315
1502
|
let chars = null;
|
|
1316
1503
|
C_TYPE_ARG_HEAD_RE.lastIndex = 0;
|
|
1317
1504
|
let m;
|
|
@@ -1389,7 +1576,7 @@ function blankCTypeKeywordArgs(source) {
|
|
|
1389
1576
|
atArgStart = false;
|
|
1390
1577
|
}
|
|
1391
1578
|
}
|
|
1392
|
-
return chars ? chars.join('') : source;
|
|
1579
|
+
return rawStrings.restore(chars ? chars.join('') : source);
|
|
1393
1580
|
}
|
|
1394
1581
|
/**
|
|
1395
1582
|
* Blank a file-scope `static`/`extern`-prefixed ALL-CAPS declaration macro —
|
|
@@ -1417,6 +1604,8 @@ const C_PREFIXED_DECL_MACRO_RE = /^[ \t]*(?:static|extern)[ \t]+[A-Z][A-Z0-9_]{2
|
|
|
1417
1604
|
function blankCFileScopePrefixedDeclMacros(source) {
|
|
1418
1605
|
if (!/^[ \t]*(?:static|extern)[ \t]+[A-Z]/m.test(source))
|
|
1419
1606
|
return source;
|
|
1607
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1608
|
+
source = rawStrings.source;
|
|
1420
1609
|
const lines = source.split('\n');
|
|
1421
1610
|
let changed = false;
|
|
1422
1611
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -1456,7 +1645,7 @@ function blankCFileScopePrefixedDeclMacros(source) {
|
|
|
1456
1645
|
lines[i] = line.replace(/[^\n\r]/g, ' ');
|
|
1457
1646
|
changed = true;
|
|
1458
1647
|
}
|
|
1459
|
-
return changed ? lines.join('\n') : source;
|
|
1648
|
+
return rawStrings.restore(changed ? lines.join('\n') : source);
|
|
1460
1649
|
}
|
|
1461
1650
|
/**
|
|
1462
1651
|
* REWRITE (the one non-blank pass in this family — it moves a token) a
|
|
@@ -1567,14 +1756,84 @@ function blankCNamedVariadicDefineDots(source) {
|
|
|
1567
1756
|
* C-detected headers in CUDA projects (llm.c keeps `__device__` helpers and
|
|
1568
1757
|
* kernel prototypes in plain `.h`) — the same content-gated CUDA blank as
|
|
1569
1758
|
* C++. Offset-preserving. */
|
|
1759
|
+
/**
|
|
1760
|
+
* Blank the argument list of a statement-level `MACRO( … );` call whose
|
|
1761
|
+
* arguments are designated initializers — betaflight's
|
|
1762
|
+
*
|
|
1763
|
+
* RESET_CONFIG(pidProfile_t, pidProfile,
|
|
1764
|
+
* .pid = { [PID_ROLL] = PID_ROLL_DEFAULT, … },
|
|
1765
|
+
* .pidSumLimit = PIDSUM_LIMIT,
|
|
1766
|
+
* …
|
|
1767
|
+
* );
|
|
1768
|
+
*
|
|
1769
|
+
* tree-sitter-c has no rule for `.field = value` as a call argument. Even a
|
|
1770
|
+
* small statement-level `M(a, b, .x = 1, .y = { 1, 2 },);` with a trailing
|
|
1771
|
+
* comma recovers by extending the enclosing `function_definition` to EOF —
|
|
1772
|
+
* the next function vanishes and later ones nest under the first (#1729 —
|
|
1773
|
+
* 310 functions in 73 files on a betaflight tree, which name matching then
|
|
1774
|
+
* treated as unreachable closures). Emptying the argument list to spaces,
|
|
1775
|
+
* newlines kept, leaves `RESET_CONFIG(\n\n…\n);` — a call the grammar parses
|
|
1776
|
+
* cleanly — at the cost of the references inside the initializer, which the
|
|
1777
|
+
* broken parse was not yielding either. Statement-level only (`);` follows),
|
|
1778
|
+
* macro-cased name only, offsets preserved. Runs before the kernel route
|
|
1779
|
+
* point, so both the wasm and kernel C arms see the same bytes.
|
|
1780
|
+
*/
|
|
1781
|
+
function blankCDesignatedMacroArgs(source) {
|
|
1782
|
+
if (source.indexOf('=') === -1)
|
|
1783
|
+
return source;
|
|
1784
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1785
|
+
source = rawStrings.source;
|
|
1786
|
+
const out = source.split('');
|
|
1787
|
+
const re = /^[ \t]*([A-Z_][A-Z0-9_]*)\s*\(/gm;
|
|
1788
|
+
let m;
|
|
1789
|
+
while ((m = re.exec(source))) {
|
|
1790
|
+
const open = m.index + m[0].length - 1;
|
|
1791
|
+
let depth = 1;
|
|
1792
|
+
let i = open + 1;
|
|
1793
|
+
for (; i < source.length && depth > 0; i++) {
|
|
1794
|
+
const c = source[i];
|
|
1795
|
+
if (c === '(')
|
|
1796
|
+
depth++;
|
|
1797
|
+
else if (c === ')')
|
|
1798
|
+
depth--;
|
|
1799
|
+
}
|
|
1800
|
+
if (depth !== 0)
|
|
1801
|
+
continue;
|
|
1802
|
+
const close = i - 1;
|
|
1803
|
+
const args = source.slice(open + 1, close);
|
|
1804
|
+
// A designator at argument depth: `.name =` or `[index] =`.
|
|
1805
|
+
if (!/(^|[,{(\s])(\.[A-Za-z_]\w*|\[[^\]]+\])\s*=[^=]/.test(args))
|
|
1806
|
+
continue;
|
|
1807
|
+
if (!/^\s*;/.test(source.slice(close + 1)))
|
|
1808
|
+
continue;
|
|
1809
|
+
for (let k = open + 1; k < close; k++)
|
|
1810
|
+
if (out[k] !== '\n')
|
|
1811
|
+
out[k] = ' ';
|
|
1812
|
+
re.lastIndex = close;
|
|
1813
|
+
}
|
|
1814
|
+
return rawStrings.restore(out.join(''));
|
|
1815
|
+
}
|
|
1570
1816
|
function preParseCSource(source) {
|
|
1571
|
-
const
|
|
1817
|
+
const rawStrings = maskCppRawStrings(source);
|
|
1818
|
+
source = rawStrings.source;
|
|
1819
|
+
const inner = blankCDesignatedMacroArgs(blankCKernelAnnotations(blankCCplusplusGuardBodies(source)));
|
|
1572
1820
|
let blanked = blankCLeadingAttrMacros(blankLoneMacroLines(blankCStatementMacroCalls(blankCTrailingParamAttrMacros(blankCppAnnotationMacroCalls(rewriteCPrefixedDeclMacroInitializers(blankCFileScopePrefixedDeclMacros(blankCVaArgQualifiedTypeArgs(blankCTypeKeywordArgs(blankCParameterizedAnnotationMacros(blankCAutoInference(blankCSandwichedAnnotations(inner))))))))))));
|
|
1573
1821
|
if (looksLikeCudaSource(blanked))
|
|
1574
1822
|
blanked = blankCudaConstructs(blanked);
|
|
1575
1823
|
// The named-variadic `#define` pass runs AFTER the directive restore — it
|
|
1576
1824
|
// deliberately edits directive lines (see its doc comment).
|
|
1577
|
-
return blankCNamedVariadicDefineDots(restoreDirectiveLines(source, blanked));
|
|
1825
|
+
return rawStrings.restore(blankCNamedVariadicDefineDots(restoreDirectiveLines(source, blanked)));
|
|
1826
|
+
}
|
|
1827
|
+
/** A constructor prototype carries defaults even when its body is in another file. */
|
|
1828
|
+
function isCppConstructorDeclaration(node) {
|
|
1829
|
+
if (node.type !== 'declaration' || (0, tree_sitter_helpers_1.getChildByField)(node, 'type'))
|
|
1830
|
+
return false;
|
|
1831
|
+
const owner = node.parent?.parent;
|
|
1832
|
+
if (!owner || !['class_specifier', 'struct_specifier', 'union_specifier'].includes(owner.type))
|
|
1833
|
+
return false;
|
|
1834
|
+
const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
1835
|
+
return declarator?.type === 'function_declarator'
|
|
1836
|
+
&& (0, tree_sitter_helpers_1.getChildByField)(declarator, 'declarator')?.text === (0, tree_sitter_helpers_1.getChildByField)(owner, 'name')?.text;
|
|
1578
1837
|
}
|
|
1579
1838
|
exports.cppExtractor = {
|
|
1580
1839
|
// Recover macro-annotated class/struct definitions (`class MYMODULE_API Foo : Base`,
|
|
@@ -1591,9 +1850,23 @@ exports.cppExtractor = {
|
|
|
1591
1850
|
// get picked as the blast-radius representative over — the single real
|
|
1592
1851
|
// definition, exactly as bodiless struct/enum specifiers are already skipped. (#1093)
|
|
1593
1852
|
skipBodilessClass: true,
|
|
1594
|
-
|
|
1853
|
+
// `function_definition` covers inline / out-of-line bodies; `field_declaration`
|
|
1854
|
+
// covers pure-virtual methods (`virtual int read(int key) = 0;`), which have no
|
|
1855
|
+
// body and would otherwise mint no node — so calls through the abstract base and
|
|
1856
|
+
// cpp-override synthesis had nothing to attach to (#1727). classifyMethodNode
|
|
1857
|
+
// keeps ordinary data members / prototypes on the children-walk path.
|
|
1858
|
+
methodTypes: ['function_definition', 'field_declaration'],
|
|
1859
|
+
classifyMethodNode: (node) => {
|
|
1860
|
+
if (node.type !== 'field_declaration')
|
|
1861
|
+
return 'method';
|
|
1862
|
+
return isCppPureVirtualMethodDecl(node) ? 'method' : 'skip';
|
|
1863
|
+
},
|
|
1864
|
+
isAbstract: (node) => (isCppPureVirtualMethodDecl(node) ? true : undefined),
|
|
1595
1865
|
interfaceTypes: [],
|
|
1596
1866
|
structTypes: ['struct_specifier'],
|
|
1867
|
+
// C++ unions additionally carry member functions, which extract through the
|
|
1868
|
+
// same aggregate-body walk as structs while preserving their distinct kind.
|
|
1869
|
+
unionTypes: ['union_specifier'],
|
|
1597
1870
|
enumTypes: ['enum_specifier'],
|
|
1598
1871
|
enumMemberTypes: ['enumerator'],
|
|
1599
1872
|
typeAliasTypes: ['type_definition', 'alias_declaration'], // typedef and using
|
|
@@ -1606,6 +1879,20 @@ exports.cppExtractor = {
|
|
|
1606
1879
|
resolveName: extractCppQualifiedMethodName,
|
|
1607
1880
|
getReceiverType: extractCppReceiverType,
|
|
1608
1881
|
getReturnType: extractCppReturnType,
|
|
1882
|
+
// Constructors (definitions and class-body declarations) carry their
|
|
1883
|
+
// parameter list as the signature; a trailing semicolon marks a prototype, so a local `T obj(args)` can be matched
|
|
1884
|
+
// to the one overload with a compatible arity (#1839). Macro-shaped
|
|
1885
|
+
// definitions whose real name was recovered from an argument are excluded:
|
|
1886
|
+
// their "parameters" are macro arguments. Mirrored in the kernel.
|
|
1887
|
+
getSignature: (node, source) => {
|
|
1888
|
+
if ((node.type !== 'function_definition' && !isCppConstructorDeclaration(node)) || (0, tree_sitter_helpers_1.getChildByField)(node, 'type'))
|
|
1889
|
+
return undefined;
|
|
1890
|
+
if (recoverCppMacroDefinedName(node, source))
|
|
1891
|
+
return undefined;
|
|
1892
|
+
const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
|
|
1893
|
+
const parameters = declarator && (0, tree_sitter_helpers_1.getChildByField)(declarator, 'parameters');
|
|
1894
|
+
return parameters ? (0, tree_sitter_helpers_1.getNodeText)(parameters, source) + (node.type === 'declaration' ? ';' : '') : undefined;
|
|
1895
|
+
},
|
|
1609
1896
|
getVisibility: (node) => {
|
|
1610
1897
|
// Check for access specifier in parent
|
|
1611
1898
|
const parent = node.parent;
|
|
@@ -1626,15 +1913,19 @@ exports.cppExtractor = {
|
|
|
1626
1913
|
return undefined;
|
|
1627
1914
|
},
|
|
1628
1915
|
resolveTypeAliasKind: (node, _source) => {
|
|
1629
|
-
// C++ typedef: `typedef enum { ... } name
|
|
1916
|
+
// C++ typedef: `typedef enum { ... } name;`, `typedef struct { ... } name;`,
|
|
1917
|
+
// or `typedef union { ... } name;` — see the C extractor.
|
|
1630
1918
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
1631
1919
|
const child = node.namedChild(i);
|
|
1632
1920
|
if (!child)
|
|
1633
1921
|
continue;
|
|
1634
1922
|
if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
1635
1923
|
return 'enum';
|
|
1636
|
-
if (child.type === 'struct_specifier' &&
|
|
1924
|
+
if (child.type === 'struct_specifier' &&
|
|
1925
|
+
(0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
1637
1926
|
return 'struct';
|
|
1927
|
+
if (child.type === 'union_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
|
|
1928
|
+
return 'union';
|
|
1638
1929
|
}
|
|
1639
1930
|
return undefined;
|
|
1640
1931
|
},
|