@aroman22/codegraph-vba-darwin-arm64 1.5.2 → 1.6.1
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/codegraph +5 -0
- package/lib/dist/bin/codegraph.d.ts +1 -1
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +307 -81
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +38 -1
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +22 -3
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/db/index.d.ts +84 -5
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +209 -12
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +80 -3
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +116 -4
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +294 -7
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +43 -1
- package/lib/dist/db/wal-valve.d.ts +106 -0
- package/lib/dist/db/wal-valve.d.ts.map +1 -0
- package/lib/dist/db/wal-valve.js +208 -0
- package/lib/dist/db/wal-valve.js.map +1 -0
- package/lib/dist/directory.d.ts +9 -5
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +210 -19
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +25 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +177 -23
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +47 -2
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +568 -51
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +563 -1
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -1
- package/lib/dist/extraction/languages/index.js +18 -0
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +140 -38
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +28 -1
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +76 -7
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +11 -4
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +60 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +905 -20
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +3 -0
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -0
- package/lib/dist/extraction/vba/call-sweep.js +206 -0
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -0
- package/lib/dist/extraction/vba/calls.d.ts +55 -0
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/calls.js +439 -0
- package/lib/dist/extraction/vba/calls.js.map +1 -0
- package/lib/dist/extraction/vba/constants.d.ts +42 -0
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -0
- package/lib/dist/extraction/vba/constants.js +112 -0
- package/lib/dist/extraction/vba/constants.js.map +1 -0
- package/lib/dist/extraction/vba/context.d.ts +175 -0
- package/lib/dist/extraction/vba/context.d.ts.map +1 -0
- package/lib/dist/extraction/vba/context.js +268 -0
- package/lib/dist/extraction/vba/context.js.map +1 -0
- package/lib/dist/extraction/vba/controls.d.ts +24 -0
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/controls.js +89 -0
- package/lib/dist/extraction/vba/controls.js.map +1 -0
- package/lib/dist/extraction/vba/declarations.d.ts +3 -0
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -0
- package/lib/dist/extraction/vba/declarations.js +154 -0
- package/lib/dist/extraction/vba/declarations.js.map +1 -0
- package/lib/dist/extraction/vba/dims.d.ts +3 -0
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -0
- package/lib/dist/extraction/vba/dims.js +186 -0
- package/lib/dist/extraction/vba/dims.js.map +1 -0
- package/lib/dist/extraction/vba/docmd.d.ts +16 -0
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -0
- package/lib/dist/extraction/vba/docmd.js +179 -0
- package/lib/dist/extraction/vba/docmd.js.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts +15 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.js +178 -0
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +3 -0
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/implements.js +52 -0
- package/lib/dist/extraction/vba/implements.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +3 -0
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -0
- package/lib/dist/extraction/vba/procedures.js +239 -0
- package/lib/dist/extraction/vba/procedures.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +17 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.js +212 -0
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -0
- package/lib/dist/extraction/vba/tempvars.d.ts +10 -0
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/tempvars.js +138 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -0
- package/lib/dist/extraction/vba/text-utils.d.ts +73 -0
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -0
- package/lib/dist/extraction/vba/text-utils.js +195 -0
- package/lib/dist/extraction/vba/text-utils.js.map +1 -0
- package/lib/dist/extraction/vba-extractor.d.ts +3 -951
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +46 -2934
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +300 -88
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +76 -17
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +81 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +460 -10
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +42 -0
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +97 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +35 -3
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +101 -9
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +2 -1
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +29 -4
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +73 -13
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +30 -4
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +14 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +18 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +14 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +28 -1
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +22 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +289 -23
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +18 -0
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/project-config.d.ts +44 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +151 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1109 -97
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +6 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +14 -6
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.js +8 -3
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +7 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +129 -4
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +64 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +476 -58
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +22 -3
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +613 -39
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +1 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +49 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +29 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +10 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +142 -4
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +2 -0
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +10 -5
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -14
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +9 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +45 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/types.d.ts +25 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +10 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +34 -2
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +164 -15
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.d.ts +87 -0
- package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/lib/dist/upgrade/remove-binary.js +289 -0
- package/lib/dist/upgrade/remove-binary.js.map +1 -0
- package/lib/dist/upgrade/update-check.d.ts +92 -0
- package/lib/dist/upgrade/update-check.d.ts.map +1 -0
- package/lib/dist/upgrade/update-check.js +258 -0
- package/lib/dist/upgrade/update-check.js.map +1 -0
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/lib/dist/reasoning/config.d.ts +0 -45
- package/lib/dist/reasoning/config.d.ts.map +0 -1
- package/lib/dist/reasoning/config.js +0 -171
- package/lib/dist/reasoning/config.js.map +0 -1
- package/lib/dist/reasoning/credentials.d.ts +0 -5
- package/lib/dist/reasoning/credentials.d.ts.map +0 -1
- package/lib/dist/reasoning/credentials.js +0 -83
- package/lib/dist/reasoning/credentials.js.map +0 -1
- package/lib/dist/reasoning/login.d.ts +0 -21
- package/lib/dist/reasoning/login.d.ts.map +0 -1
- package/lib/dist/reasoning/login.js +0 -85
- package/lib/dist/reasoning/login.js.map +0 -1
- package/lib/dist/reasoning/reasoner.d.ts +0 -43
- package/lib/dist/reasoning/reasoner.d.ts.map +0 -1
- package/lib/dist/reasoning/reasoner.js +0 -308
- package/lib/dist/reasoning/reasoner.js.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VbaExtractorContext — the shared state + shared helpers threaded through
|
|
3
|
+
* every VBA extraction pass.
|
|
4
|
+
*
|
|
5
|
+
* It owns the node/edge/reference accumulators, the per-file lookup maps
|
|
6
|
+
* (`localProcs`, `functionNodeByName`, `localVarTypeMap`, `localConstants`,
|
|
7
|
+
* `localEvents`), the lazily-created module/class node, and the de-dup caches.
|
|
8
|
+
* The per-concern sweeps under `src/extraction/vba/*` are free functions that
|
|
9
|
+
* take a `VbaExtractorContext` and read/write this shared state; the handful
|
|
10
|
+
* of helpers that more than one sweep needs (`emitReference`,
|
|
11
|
+
* `pushContainsFromModule`, `findOrCreateFunctionNodeId`, the qualified-call
|
|
12
|
+
* gates, and the per-scope Const lookup) live here as methods.
|
|
13
|
+
*/
|
|
14
|
+
import { Node, Edge, ExtractionError, UnresolvedReference } from '../../types';
|
|
15
|
+
export interface ProcInfo {
|
|
16
|
+
name: string;
|
|
17
|
+
qualifiedName: string;
|
|
18
|
+
kind: 'sub' | 'function' | 'property';
|
|
19
|
+
visibility: 'public' | 'private' | 'protected' | 'internal';
|
|
20
|
+
startLine: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class VbaExtractorContext {
|
|
23
|
+
filePath: string;
|
|
24
|
+
nodes: Node[];
|
|
25
|
+
edges: Edge[];
|
|
26
|
+
errors: ExtractionError[];
|
|
27
|
+
unresolvedReferences: UnresolvedReference[];
|
|
28
|
+
moduleOrClassNode: Node | null;
|
|
29
|
+
/**
|
|
30
|
+
* Class-name prefix for `qualifiedName` composition.
|
|
31
|
+
*
|
|
32
|
+
* B3 (hueco 5): for `.cls` files every function node's `qualifiedName`
|
|
33
|
+
* is composed as `${className}.${procName}` (e.g. `Form_TestForm.Form_Load`)
|
|
34
|
+
* so cross-class callers can disambiguate which form each `Form_Load`
|
|
35
|
+
* belongs to. For `.bas` files this is `null` — module-scoped procs keep
|
|
36
|
+
* their bare-name `qualifiedName`. Resolved once per `extract()` from
|
|
37
|
+
* `isCls` + `vbName`; `sweepProcedures` reads it.
|
|
38
|
+
*/
|
|
39
|
+
classNamePrefix: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Map of procedure name (within this file) → list of ProcInfo. The list
|
|
42
|
+
* (rather than a single value) is needed because VBA allows multiple
|
|
43
|
+
* Property accessors with the same name: `Property Get Foo`, `Property
|
|
44
|
+
* Let Foo`, and `Property Set Foo` all share the name `Foo`.
|
|
45
|
+
*/
|
|
46
|
+
localProcs: Map<string, ProcInfo[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Cache: procedure name → first matching function node emitted for that
|
|
49
|
+
* name (audit S2 — O(1) same-file call resolution).
|
|
50
|
+
*/
|
|
51
|
+
functionNodeByName: Map<string, Node>;
|
|
52
|
+
/**
|
|
53
|
+
* Cache: startLine → function node emitted for that line. When Property
|
|
54
|
+
* Get/Let/Set share a name, we find the SPECIFIC accessor's node by its
|
|
55
|
+
* declaration line (Fix 1).
|
|
56
|
+
*/
|
|
57
|
+
functionNodeByStartLine: Map<number, Node>;
|
|
58
|
+
/** Edges whose source needs to be set to the module/class id once it exists. */
|
|
59
|
+
pendingModuleOrClassSource: Edge[];
|
|
60
|
+
/** Cache so we don't re-emit the same proc function node per call site. */
|
|
61
|
+
procNodeIdCache: Map<string, string>;
|
|
62
|
+
callDedupe: Set<string>;
|
|
63
|
+
synthFunctionNodeIds: Set<string>;
|
|
64
|
+
/**
|
|
65
|
+
* B4 (hueco 6) extended by Issue #48: cache of stub node ids we've already
|
|
66
|
+
* emitted for a given (method, target name) pair in this file. Keyed by
|
|
67
|
+
* `${cacheKey}:${lowerName}` so the OpenForm and OpenReport de-dup buckets
|
|
68
|
+
* stay disjoint.
|
|
69
|
+
*/
|
|
70
|
+
opensStubIdsByKey: Map<string, string>;
|
|
71
|
+
synthClassNodeIds: Set<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Issue #50: TempVars placeholder-node de-dup cache. Keys are the
|
|
74
|
+
* deterministic node ids produced by `emitTempVarReference` — those ids
|
|
75
|
+
* intentionally use a synthetic `synthetic:tempvar/<key>` path so the SAME
|
|
76
|
+
* key referenced from Form_A.cls AND Form_B.cls collapses to ONE node.
|
|
77
|
+
*/
|
|
78
|
+
synthTempVarNodeIds: Set<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Maps `variableName.toLowerCase()` → declared type info.
|
|
81
|
+
* Built by `sweepDimsAndWithEvents`; consulted by the unified qualified-call
|
|
82
|
+
* gate (`shouldProcessQualifiedCall`) so declared project-class locals emit
|
|
83
|
+
* edges, declared primitive/external locals stay silent, and undeclared
|
|
84
|
+
* receivers remain module-name candidates for the resolver (Fix 2 / Issue #2).
|
|
85
|
+
*/
|
|
86
|
+
localVarTypeMap: Map<string, {
|
|
87
|
+
outer: string;
|
|
88
|
+
qualified: boolean;
|
|
89
|
+
withEvents?: boolean;
|
|
90
|
+
variableName?: string;
|
|
91
|
+
assignedWithSet?: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Issue #52: Const resolution buckets, scoped per procedure. Key is
|
|
95
|
+
* `'module'` for module-level Consts, or the procedure's `startLine`
|
|
96
|
+
* (stringified) for proc-local Consts. Each bucket maps the lowercase
|
|
97
|
+
* constant name to its simple-literal value (used by `DoCmd.OpenForm` /
|
|
98
|
+
* `OpenReport` / `OpenQuery` argument resolution via `resolveLocalConst`).
|
|
99
|
+
*/
|
|
100
|
+
localConstants: Map<'module' | string, Map<string, string>>;
|
|
101
|
+
/**
|
|
102
|
+
* Issue #52: the current Const-lookup scope. `'module'` when no procedure
|
|
103
|
+
* is open, otherwise the top-of-stack proc's `startLine` as a string. Both
|
|
104
|
+
* `sweepEnumsAndConsts` and `sweepCallsAndSql` keep this in sync with their
|
|
105
|
+
* per-line stack walk.
|
|
106
|
+
*/
|
|
107
|
+
currentProcKey: 'module' | string;
|
|
108
|
+
/**
|
|
109
|
+
* Issue #52: per-extraction proc-stack shared between `sweepEnumsAndConsts`
|
|
110
|
+
* and `sweepCallsAndSql`. Each sweep clears it at the start so the file's
|
|
111
|
+
* mid-proc structural state never leaks across sweeps. Holds the `startLine`
|
|
112
|
+
* of every procedure whose `End` marker the sweep has not yet seen.
|
|
113
|
+
*/
|
|
114
|
+
procStack: number[];
|
|
115
|
+
/** Local event name (lowercase) → event node for `RaiseEvent` edge emission. */
|
|
116
|
+
localEvents: Map<string, Node>;
|
|
117
|
+
constructor(filePath: string);
|
|
118
|
+
/**
|
|
119
|
+
* Emit a `contains` edge from the (lazily-created) module/class node to
|
|
120
|
+
* `targetId`. Mirrors the pending-source pattern the procedure and
|
|
121
|
+
* implements sweeps use: the module node doesn't exist yet, so the edge's
|
|
122
|
+
* source is rewritten once `extract()` creates it.
|
|
123
|
+
*/
|
|
124
|
+
pushContainsFromModule(targetId: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Fix 2 (Issue #2): return true iff `receiverName` is a file-local variable
|
|
127
|
+
* (appears in `localVarTypeMap`) whose declared type is a SIMPLE (non-
|
|
128
|
+
* qualified, non-primitive) identifier — a candidate project-defined class.
|
|
129
|
+
* Qualified types (e.g. `DAO.Recordset`) and primitives (`String`, `Long`)
|
|
130
|
+
* return false so runtime/DAO calls are suppressed. Brackets are stripped
|
|
131
|
+
* from the lookup key defensively (Issue #54).
|
|
132
|
+
*/
|
|
133
|
+
isLocalProjectClassVar(receiverName: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Qualified-call eligibility is intentionally shared by paren-form
|
|
136
|
+
* (`Receiver.Member(...)`) and statement-form (`Receiver.Member args`) scans:
|
|
137
|
+
* project-class locals are processed after type resolution, declared
|
|
138
|
+
* primitive/external locals are silent, and undeclared receivers remain
|
|
139
|
+
* candidate module names.
|
|
140
|
+
*/
|
|
141
|
+
shouldProcessQualifiedCall(receiverName: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* #12a: resolve the "receiver type" used to build a qualified call-stub's
|
|
144
|
+
* name/qualifiedName. When `receiverName` is a file-local variable typed
|
|
145
|
+
* as a candidate project class (`isLocalProjectClassVar`), returns the
|
|
146
|
+
* RESOLVED CLASS NAME from `localVarTypeMap` (e.g. `m_NCOp As NCOperaciones`
|
|
147
|
+
* → `'NCOperaciones'`) so the stub matches the real `.cls` method's
|
|
148
|
+
* `${className}.${proc}` shape. Otherwise returns `receiverName` unchanged
|
|
149
|
+
* (the `.bas`-qualified module call case).
|
|
150
|
+
*/
|
|
151
|
+
resolveReceiverType(receiverName: string): string;
|
|
152
|
+
findOrCreateFunctionNodeId(proc: ProcInfo): string;
|
|
153
|
+
findFunctionNodeByName(name: string): Node | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Emit a `references` edge from the file's module/class node to a synthetic
|
|
156
|
+
* node named `targetName`. Used by Dim, WithEvents, Set-New, and SQL sweeps.
|
|
157
|
+
* Fix 5: the synthetic node id is keyed on (filePath, kind, name) WITHOUT
|
|
158
|
+
* lineNum so the same type/table referenced on N lines produces ONE node.
|
|
159
|
+
*/
|
|
160
|
+
emitReference(targetName: string, lineNum: number, column: number, synthesizedBy: string): void;
|
|
161
|
+
/**
|
|
162
|
+
* Issue #52: shared lookup helper for `scanDoCmdOpenCalls` and
|
|
163
|
+
* `scanDoCmdOpenQuery`. The current scope is the procedure whose
|
|
164
|
+
* `startLine` is on top of `procStack` (or `'module'` when empty).
|
|
165
|
+
* Per-proc bucket first; module bucket is the fallback.
|
|
166
|
+
*/
|
|
167
|
+
resolveLocalConst(name: string): string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Issue #52: shared writer. `scopeKey` is `'module'` or the procedure's
|
|
170
|
+
* startLine-as-string. Creates the bucket lazily. Returns the bucket the
|
|
171
|
+
* value was written to (mostly useful for tests).
|
|
172
|
+
*/
|
|
173
|
+
setLocalConstInScope(scopeKey: 'module' | string, name: string, value: string): Map<string, string>;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,eAAe,EACf,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;IACtC,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAmB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,MAAM,EAAE,eAAe,EAAE,CAAM;IAC/B,oBAAoB,EAAE,mBAAmB,EAAE,CAAM;IACjD,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE7C;;;;;;;;;OASG;IACI,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7C;;;;;OAKG;IACI,UAAU,0BAAiC;IAElD;;;OAGG;IACI,kBAAkB,oBAA2B;IAEpD;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AAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW1D;;;;OAIG;IACI,oBAAoB,CACzB,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CASvB"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VbaExtractorContext = void 0;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
class VbaExtractorContext {
|
|
7
|
+
filePath;
|
|
8
|
+
nodes = [];
|
|
9
|
+
edges = [];
|
|
10
|
+
errors = [];
|
|
11
|
+
unresolvedReferences = [];
|
|
12
|
+
moduleOrClassNode = null;
|
|
13
|
+
/**
|
|
14
|
+
* Class-name prefix for `qualifiedName` composition.
|
|
15
|
+
*
|
|
16
|
+
* B3 (hueco 5): for `.cls` files every function node's `qualifiedName`
|
|
17
|
+
* is composed as `${className}.${procName}` (e.g. `Form_TestForm.Form_Load`)
|
|
18
|
+
* so cross-class callers can disambiguate which form each `Form_Load`
|
|
19
|
+
* belongs to. For `.bas` files this is `null` — module-scoped procs keep
|
|
20
|
+
* their bare-name `qualifiedName`. Resolved once per `extract()` from
|
|
21
|
+
* `isCls` + `vbName`; `sweepProcedures` reads it.
|
|
22
|
+
*/
|
|
23
|
+
classNamePrefix = null;
|
|
24
|
+
/**
|
|
25
|
+
* Map of procedure name (within this file) → list of ProcInfo. The list
|
|
26
|
+
* (rather than a single value) is needed because VBA allows multiple
|
|
27
|
+
* Property accessors with the same name: `Property Get Foo`, `Property
|
|
28
|
+
* Let Foo`, and `Property Set Foo` all share the name `Foo`.
|
|
29
|
+
*/
|
|
30
|
+
localProcs = new Map();
|
|
31
|
+
/**
|
|
32
|
+
* Cache: procedure name → first matching function node emitted for that
|
|
33
|
+
* name (audit S2 — O(1) same-file call resolution).
|
|
34
|
+
*/
|
|
35
|
+
functionNodeByName = new Map();
|
|
36
|
+
/**
|
|
37
|
+
* Cache: startLine → function node emitted for that line. When Property
|
|
38
|
+
* Get/Let/Set share a name, we find the SPECIFIC accessor's node by its
|
|
39
|
+
* declaration line (Fix 1).
|
|
40
|
+
*/
|
|
41
|
+
functionNodeByStartLine = new Map();
|
|
42
|
+
/** Edges whose source needs to be set to the module/class id once it exists. */
|
|
43
|
+
pendingModuleOrClassSource = [];
|
|
44
|
+
/** Cache so we don't re-emit the same proc function node per call site. */
|
|
45
|
+
procNodeIdCache = new Map();
|
|
46
|
+
callDedupe = new Set();
|
|
47
|
+
synthFunctionNodeIds = new Set();
|
|
48
|
+
/**
|
|
49
|
+
* B4 (hueco 6) extended by Issue #48: cache of stub node ids we've already
|
|
50
|
+
* emitted for a given (method, target name) pair in this file. Keyed by
|
|
51
|
+
* `${cacheKey}:${lowerName}` so the OpenForm and OpenReport de-dup buckets
|
|
52
|
+
* stay disjoint.
|
|
53
|
+
*/
|
|
54
|
+
opensStubIdsByKey = new Map();
|
|
55
|
+
synthClassNodeIds = new Set();
|
|
56
|
+
/**
|
|
57
|
+
* Issue #50: TempVars placeholder-node de-dup cache. Keys are the
|
|
58
|
+
* deterministic node ids produced by `emitTempVarReference` — those ids
|
|
59
|
+
* intentionally use a synthetic `synthetic:tempvar/<key>` path so the SAME
|
|
60
|
+
* key referenced from Form_A.cls AND Form_B.cls collapses to ONE node.
|
|
61
|
+
*/
|
|
62
|
+
synthTempVarNodeIds = new Set();
|
|
63
|
+
/**
|
|
64
|
+
* Maps `variableName.toLowerCase()` → declared type info.
|
|
65
|
+
* Built by `sweepDimsAndWithEvents`; consulted by the unified qualified-call
|
|
66
|
+
* gate (`shouldProcessQualifiedCall`) so declared project-class locals emit
|
|
67
|
+
* edges, declared primitive/external locals stay silent, and undeclared
|
|
68
|
+
* receivers remain module-name candidates for the resolver (Fix 2 / Issue #2).
|
|
69
|
+
*/
|
|
70
|
+
localVarTypeMap = new Map();
|
|
71
|
+
/**
|
|
72
|
+
* Issue #52: Const resolution buckets, scoped per procedure. Key is
|
|
73
|
+
* `'module'` for module-level Consts, or the procedure's `startLine`
|
|
74
|
+
* (stringified) for proc-local Consts. Each bucket maps the lowercase
|
|
75
|
+
* constant name to its simple-literal value (used by `DoCmd.OpenForm` /
|
|
76
|
+
* `OpenReport` / `OpenQuery` argument resolution via `resolveLocalConst`).
|
|
77
|
+
*/
|
|
78
|
+
localConstants = new Map();
|
|
79
|
+
/**
|
|
80
|
+
* Issue #52: the current Const-lookup scope. `'module'` when no procedure
|
|
81
|
+
* is open, otherwise the top-of-stack proc's `startLine` as a string. Both
|
|
82
|
+
* `sweepEnumsAndConsts` and `sweepCallsAndSql` keep this in sync with their
|
|
83
|
+
* per-line stack walk.
|
|
84
|
+
*/
|
|
85
|
+
currentProcKey = 'module';
|
|
86
|
+
/**
|
|
87
|
+
* Issue #52: per-extraction proc-stack shared between `sweepEnumsAndConsts`
|
|
88
|
+
* and `sweepCallsAndSql`. Each sweep clears it at the start so the file's
|
|
89
|
+
* mid-proc structural state never leaks across sweeps. Holds the `startLine`
|
|
90
|
+
* of every procedure whose `End` marker the sweep has not yet seen.
|
|
91
|
+
*/
|
|
92
|
+
procStack = [];
|
|
93
|
+
/** Local event name (lowercase) → event node for `RaiseEvent` edge emission. */
|
|
94
|
+
localEvents = new Map();
|
|
95
|
+
constructor(filePath) {
|
|
96
|
+
this.filePath = filePath;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Emit a `contains` edge from the (lazily-created) module/class node to
|
|
100
|
+
* `targetId`. Mirrors the pending-source pattern the procedure and
|
|
101
|
+
* implements sweeps use: the module node doesn't exist yet, so the edge's
|
|
102
|
+
* source is rewritten once `extract()` creates it.
|
|
103
|
+
*/
|
|
104
|
+
pushContainsFromModule(targetId) {
|
|
105
|
+
if (this.moduleOrClassNode) {
|
|
106
|
+
this.edges.push({
|
|
107
|
+
source: this.moduleOrClassNode.id,
|
|
108
|
+
target: targetId,
|
|
109
|
+
kind: 'contains',
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const edge = { source: '', target: targetId, kind: 'contains' };
|
|
114
|
+
this.edges.push(edge);
|
|
115
|
+
this.pendingModuleOrClassSource.push(edge);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Fix 2 (Issue #2): return true iff `receiverName` is a file-local variable
|
|
119
|
+
* (appears in `localVarTypeMap`) whose declared type is a SIMPLE (non-
|
|
120
|
+
* qualified, non-primitive) identifier — a candidate project-defined class.
|
|
121
|
+
* Qualified types (e.g. `DAO.Recordset`) and primitives (`String`, `Long`)
|
|
122
|
+
* return false so runtime/DAO calls are suppressed. Brackets are stripped
|
|
123
|
+
* from the lookup key defensively (Issue #54).
|
|
124
|
+
*/
|
|
125
|
+
isLocalProjectClassVar(receiverName) {
|
|
126
|
+
// Issue #54: strip a single leading `[` and/or trailing `]` if present.
|
|
127
|
+
const key = receiverName.replace(/^\[|\]$/g, '').toLowerCase();
|
|
128
|
+
const entry = this.localVarTypeMap.get(key);
|
|
129
|
+
if (!entry)
|
|
130
|
+
return false; // not declared in this file → silent
|
|
131
|
+
if (entry.qualified)
|
|
132
|
+
return false; // DAO.Recordset etc. → silent
|
|
133
|
+
if (constants_1.PRIMITIVE_TYPES.has(entry.outer.toLowerCase()))
|
|
134
|
+
return false;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Qualified-call eligibility is intentionally shared by paren-form
|
|
139
|
+
* (`Receiver.Member(...)`) and statement-form (`Receiver.Member args`) scans:
|
|
140
|
+
* project-class locals are processed after type resolution, declared
|
|
141
|
+
* primitive/external locals are silent, and undeclared receivers remain
|
|
142
|
+
* candidate module names.
|
|
143
|
+
*/
|
|
144
|
+
shouldProcessQualifiedCall(receiverName) {
|
|
145
|
+
if (this.isLocalProjectClassVar(receiverName))
|
|
146
|
+
return true;
|
|
147
|
+
return !this.localVarTypeMap.has(receiverName.toLowerCase());
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* #12a: resolve the "receiver type" used to build a qualified call-stub's
|
|
151
|
+
* name/qualifiedName. When `receiverName` is a file-local variable typed
|
|
152
|
+
* as a candidate project class (`isLocalProjectClassVar`), returns the
|
|
153
|
+
* RESOLVED CLASS NAME from `localVarTypeMap` (e.g. `m_NCOp As NCOperaciones`
|
|
154
|
+
* → `'NCOperaciones'`) so the stub matches the real `.cls` method's
|
|
155
|
+
* `${className}.${proc}` shape. Otherwise returns `receiverName` unchanged
|
|
156
|
+
* (the `.bas`-qualified module call case).
|
|
157
|
+
*/
|
|
158
|
+
resolveReceiverType(receiverName) {
|
|
159
|
+
if (this.isLocalProjectClassVar(receiverName)) {
|
|
160
|
+
const key = receiverName.replace(/^\[|\]$/g, '').toLowerCase();
|
|
161
|
+
const entry = this.localVarTypeMap.get(key);
|
|
162
|
+
if (entry)
|
|
163
|
+
return entry.outer;
|
|
164
|
+
}
|
|
165
|
+
return receiverName;
|
|
166
|
+
}
|
|
167
|
+
findOrCreateFunctionNodeId(proc) {
|
|
168
|
+
// Fix 1: key the cache by `name:startLine` so Property Get/Let/Set
|
|
169
|
+
// accessors with the same name each resolve to their own node.
|
|
170
|
+
const cacheKey = `${proc.name}:${proc.startLine}`;
|
|
171
|
+
const cached = this.procNodeIdCache.get(cacheKey);
|
|
172
|
+
if (cached)
|
|
173
|
+
return cached;
|
|
174
|
+
// Prefer the startLine-indexed lookup (O(1), correct for all three
|
|
175
|
+
// Property accessors). Fall back to the name-indexed cache for procs
|
|
176
|
+
// whose startLine wasn't recorded (should not happen in practice).
|
|
177
|
+
const fn = this.functionNodeByStartLine.get(proc.startLine) ??
|
|
178
|
+
this.findFunctionNodeByName(proc.name);
|
|
179
|
+
if (fn) {
|
|
180
|
+
this.procNodeIdCache.set(cacheKey, fn.id);
|
|
181
|
+
return fn.id;
|
|
182
|
+
}
|
|
183
|
+
// Fallback: synthesize a node id matching generateNodeId's input shape.
|
|
184
|
+
const id = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'function', proc.name, proc.startLine);
|
|
185
|
+
this.procNodeIdCache.set(cacheKey, id);
|
|
186
|
+
return id;
|
|
187
|
+
}
|
|
188
|
+
findFunctionNodeByName(name) {
|
|
189
|
+
// O(1) via the cache populated as function nodes are emitted in
|
|
190
|
+
// `sweepProcedures` (audit S2 — replaced an O(n) linear scan per call site).
|
|
191
|
+
return this.functionNodeByName.get(name);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Emit a `references` edge from the file's module/class node to a synthetic
|
|
195
|
+
* node named `targetName`. Used by Dim, WithEvents, Set-New, and SQL sweeps.
|
|
196
|
+
* Fix 5: the synthetic node id is keyed on (filePath, kind, name) WITHOUT
|
|
197
|
+
* lineNum so the same type/table referenced on N lines produces ONE node.
|
|
198
|
+
*/
|
|
199
|
+
emitReference(targetName, lineNum, column, synthesizedBy) {
|
|
200
|
+
if (!targetName)
|
|
201
|
+
return;
|
|
202
|
+
const targetId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'class', // placeholder kind; cross-file resolution will re-type at lookup
|
|
203
|
+
targetName, 0);
|
|
204
|
+
if (this.synthClassNodeIds.has(targetId)) {
|
|
205
|
+
// Node already emitted for this name — only add the edge below.
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.synthClassNodeIds.add(targetId);
|
|
209
|
+
this.nodes.push({
|
|
210
|
+
id: targetId,
|
|
211
|
+
kind: 'class',
|
|
212
|
+
name: targetName,
|
|
213
|
+
qualifiedName: targetName,
|
|
214
|
+
filePath: this.filePath,
|
|
215
|
+
language: 'vba',
|
|
216
|
+
startLine: lineNum,
|
|
217
|
+
endLine: lineNum,
|
|
218
|
+
startColumn: column,
|
|
219
|
+
endColumn: column + targetName.length,
|
|
220
|
+
updatedAt: Date.now(),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const edge = {
|
|
224
|
+
source: '', // rewritten after module node exists
|
|
225
|
+
target: targetId,
|
|
226
|
+
kind: 'references',
|
|
227
|
+
provenance: 'heuristic',
|
|
228
|
+
metadata: { synthesizedBy },
|
|
229
|
+
line: lineNum,
|
|
230
|
+
column,
|
|
231
|
+
};
|
|
232
|
+
this.edges.push(edge);
|
|
233
|
+
this.pendingModuleOrClassSource.push(edge);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Issue #52: shared lookup helper for `scanDoCmdOpenCalls` and
|
|
237
|
+
* `scanDoCmdOpenQuery`. The current scope is the procedure whose
|
|
238
|
+
* `startLine` is on top of `procStack` (or `'module'` when empty).
|
|
239
|
+
* Per-proc bucket first; module bucket is the fallback.
|
|
240
|
+
*/
|
|
241
|
+
resolveLocalConst(name) {
|
|
242
|
+
const lower = name.toLowerCase();
|
|
243
|
+
const procBucket = this.localConstants.get(this.currentProcKey);
|
|
244
|
+
if (procBucket) {
|
|
245
|
+
const v = procBucket.get(lower);
|
|
246
|
+
if (v !== undefined)
|
|
247
|
+
return v;
|
|
248
|
+
}
|
|
249
|
+
const moduleBucket = this.localConstants.get('module');
|
|
250
|
+
return moduleBucket?.get(lower);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Issue #52: shared writer. `scopeKey` is `'module'` or the procedure's
|
|
254
|
+
* startLine-as-string. Creates the bucket lazily. Returns the bucket the
|
|
255
|
+
* value was written to (mostly useful for tests).
|
|
256
|
+
*/
|
|
257
|
+
setLocalConstInScope(scopeKey, name, value) {
|
|
258
|
+
let bucket = this.localConstants.get(scopeKey);
|
|
259
|
+
if (!bucket) {
|
|
260
|
+
bucket = new Map();
|
|
261
|
+
this.localConstants.set(scopeKey, bucket);
|
|
262
|
+
}
|
|
263
|
+
bucket.set(name.toLowerCase(), value);
|
|
264
|
+
return bucket;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.VbaExtractorContext = VbaExtractorContext;
|
|
268
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/extraction/vba/context.ts"],"names":[],"mappings":";;;AAmBA,gEAAwD;AACxD,2CAA8C;AAU9C,MAAa,mBAAmB;IACvB,QAAQ,CAAS;IACjB,KAAK,GAAW,EAAE,CAAC;IACnB,KAAK,GAAW,EAAE,CAAC;IACnB,MAAM,GAAsB,EAAE,CAAC;IAC/B,oBAAoB,GAA0B,EAAE,CAAC;IACjD,iBAAiB,GAAgB,IAAI,CAAC;IAE7C;;;;;;;;;OASG;IACI,eAAe,GAAkB,IAAI,CAAC;IAE7C;;;;;OAKG;IACI,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;IAElD;;;OAGG;IACI,kBAAkB,GAAG,IAAI,GAAG,EAAgB,CAAC;IAEpD;;;;OAIG;IACI,uBAAuB,GAAG,IAAI,GAAG,EAAgB,CAAC;IAEzD,gFAAgF;IACzE,0BAA0B,GAAW,EAAE,CAAC;IAE/C,2EAA2E;IACpE,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhD;;;;;OAKG;IACI,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE9C,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE7C;;;;;OAKG;IACI,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/C;;;;;;OAMG;IACI,eAAe,GAAG,IAAI,GAAG,EAM5B,CAAC;IAEL;;;;;;OAMG;IACI,cAAc,GAAgD,IAAI,GAAG,EAAE,CAAC;IAE/E;;;;;OAKG;IACI,cAAc,GAAsB,QAAQ,CAAC;IAEpD;;;;;OAKG;IACI,SAAS,GAAa,EAAE,CAAC;IAEhC,gFAAgF;IACzE,WAAW,GAAG,IAAI,GAAG,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Control>` / `Me!<Control>` (hueco 1, issue
|
|
3
|
+
* #44) and cross-form `Forms!<Form>` / `Forms("<Form>")!<Ctl>` bang refs
|
|
4
|
+
* (issue #44). Both emit `UnresolvedReference`s (no synthetic `function`
|
|
5
|
+
* node) the resolver later binds to the form's controls.
|
|
6
|
+
*/
|
|
7
|
+
import { VbaExtractorContext, ProcInfo } from './context';
|
|
8
|
+
/**
|
|
9
|
+
* Hueco 1: scan a line for `Me.<ControlName>` / `Me!<ControlName>`
|
|
10
|
+
* patterns and emit one UnresolvedReference per occurrence, tagged
|
|
11
|
+
* `metadata.synthesizedBy: 'vba-me-control'`. Operates on the masked
|
|
12
|
+
* `callScanLine`. The +3 column offset skips the 3-char `Me.` / `Me!`
|
|
13
|
+
* prefix (both are 3 chars).
|
|
14
|
+
*/
|
|
15
|
+
export declare function scanMeControlReferences(ctx: VbaExtractorContext, line: string, from: ProcInfo, lineNum: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Issue #44: scan a line for cross-form bang references
|
|
18
|
+
* (`Forms!<FormName>[!<Ctl>]` and `Forms("<FormName>")!<Ctl>`) and
|
|
19
|
+
* emit ONE UnresolvedReference per match with `metadata.synthesizedBy
|
|
20
|
+
* = 'vba-forms-bang'`. Operates on the ORIGINAL (unmasked) line. The form
|
|
21
|
+
* identifier is unwrapped of surrounding `"` quotes and `[…]` brackets.
|
|
22
|
+
*/
|
|
23
|
+
export declare function scanFormsBang(ctx: VbaExtractorContext, line: string, from: ProcInfo, lineNum: number): void;
|
|
24
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/controls.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA2B1D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAiBN;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CA0BN"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanMeControlReferences = scanMeControlReferences;
|
|
4
|
+
exports.scanFormsBang = scanFormsBang;
|
|
5
|
+
/**
|
|
6
|
+
* `Me.<ControlName>` / `Me!<ControlName>` reference capture — hole 1
|
|
7
|
+
* of VBA control-modeling. Issue #44 extended it from `Me\.` to `Me[.!]`
|
|
8
|
+
* so the bang form (default-collection shortcut) is captured
|
|
9
|
+
* byte-identically to the dot form. Only the FIRST identifier after
|
|
10
|
+
* `Me.`/`Me!` is captured; trailing `.Caption`/`.Value` are properties of
|
|
11
|
+
* the control, not new symbols. Provenance: `vba-me-control`.
|
|
12
|
+
*/
|
|
13
|
+
const ME_CONTROL_RE = /\bMe[.!](\p{L}[\p{L}\p{N}_]*)/gu;
|
|
14
|
+
/**
|
|
15
|
+
* Issue #44: `Forms!<FormName>` / `Forms("<FormName>")!<Ctl>` cross-form
|
|
16
|
+
* reference capture — companion to `ME_CONTROL_RE`. `Forms` is in
|
|
17
|
+
* `RUNTIME_RECEIVER_BLACKLIST`, so the generic CALL_RE path skips it; this
|
|
18
|
+
* dedicated scanner surfaces the form → control binding as an
|
|
19
|
+
* `UnresolvedReference` (`vba-forms-bang`), with NO synthetic `function`
|
|
20
|
+
* node (W4 invariant). The bang alternative's `(?![.\w])` lookahead drops
|
|
21
|
+
* `Forms!FormX.Foo` (a property access on the form, not a control access).
|
|
22
|
+
*
|
|
23
|
+
* Operates on the ORIGINAL (unmasked) line — the paren form
|
|
24
|
+
* `Forms("FormX")!txtY` carries the form name INSIDE a string literal.
|
|
25
|
+
*/
|
|
26
|
+
const FORMS_BANG_RE = /\b(?:Forms!(\p{L}[\p{L}\p{N}_]*|\[[^\]]+\])(?![.\w])|Forms\(\s*(?:"((?:[^"]|"")*)"|(\p{L}[\p{L}\p{N}_]*|\[[^\]]+\]))\s*\)\s*!\s*(?:\p{L}[\p{L}\p{N}_]*|\[[^\]]+\]))/gu;
|
|
27
|
+
/**
|
|
28
|
+
* Hueco 1: scan a line for `Me.<ControlName>` / `Me!<ControlName>`
|
|
29
|
+
* patterns and emit one UnresolvedReference per occurrence, tagged
|
|
30
|
+
* `metadata.synthesizedBy: 'vba-me-control'`. Operates on the masked
|
|
31
|
+
* `callScanLine`. The +3 column offset skips the 3-char `Me.` / `Me!`
|
|
32
|
+
* prefix (both are 3 chars).
|
|
33
|
+
*/
|
|
34
|
+
function scanMeControlReferences(ctx, line, from, lineNum) {
|
|
35
|
+
ME_CONTROL_RE.lastIndex = 0;
|
|
36
|
+
let m;
|
|
37
|
+
while ((m = ME_CONTROL_RE.exec(line)) !== null) {
|
|
38
|
+
const controlName = m[1] ?? '';
|
|
39
|
+
if (!controlName)
|
|
40
|
+
continue;
|
|
41
|
+
ctx.unresolvedReferences.push({
|
|
42
|
+
fromNodeId: ctx.findOrCreateFunctionNodeId(from),
|
|
43
|
+
referenceName: controlName,
|
|
44
|
+
referenceKind: 'references',
|
|
45
|
+
line: lineNum,
|
|
46
|
+
column: m.index + 3, // +3 to skip the `Me.` / `Me!` prefix
|
|
47
|
+
filePath: ctx.filePath,
|
|
48
|
+
language: 'vba',
|
|
49
|
+
metadata: { synthesizedBy: 'vba-me-control' },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Issue #44: scan a line for cross-form bang references
|
|
55
|
+
* (`Forms!<FormName>[!<Ctl>]` and `Forms("<FormName>")!<Ctl>`) and
|
|
56
|
+
* emit ONE UnresolvedReference per match with `metadata.synthesizedBy
|
|
57
|
+
* = 'vba-forms-bang'`. Operates on the ORIGINAL (unmasked) line. The form
|
|
58
|
+
* identifier is unwrapped of surrounding `"` quotes and `[…]` brackets.
|
|
59
|
+
*/
|
|
60
|
+
function scanFormsBang(ctx, line, from, lineNum) {
|
|
61
|
+
FORMS_BANG_RE.lastIndex = 0;
|
|
62
|
+
let m;
|
|
63
|
+
while ((m = FORMS_BANG_RE.exec(line)) !== null) {
|
|
64
|
+
// Group 1: bang form name (bare or `[bracketed]`); group 2: paren
|
|
65
|
+
// form name in `"quotes"`; group 3: paren form name bare or
|
|
66
|
+
// `[bracketed]`. Take whichever the regex alternative produced and
|
|
67
|
+
// strip the surrounding decoration so the public referenceName is
|
|
68
|
+
// the bare form identifier.
|
|
69
|
+
const raw = m[1] ?? m[2] ?? m[3] ?? '';
|
|
70
|
+
if (!raw)
|
|
71
|
+
continue;
|
|
72
|
+
const formName = raw
|
|
73
|
+
.replace(/^"|"$/g, '') // strip surrounding string-literal quotes
|
|
74
|
+
.replace(/^\[|\]$/g, ''); // strip surrounding bracket decoration (#54)
|
|
75
|
+
if (!formName)
|
|
76
|
+
continue;
|
|
77
|
+
ctx.unresolvedReferences.push({
|
|
78
|
+
fromNodeId: ctx.findOrCreateFunctionNodeId(from),
|
|
79
|
+
referenceName: formName,
|
|
80
|
+
referenceKind: 'references',
|
|
81
|
+
line: lineNum,
|
|
82
|
+
column: m.index, // start of the `Forms` keyword
|
|
83
|
+
filePath: ctx.filePath,
|
|
84
|
+
language: 'vba',
|
|
85
|
+
metadata: { synthesizedBy: 'vba-forms-bang' },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../../src/extraction/vba/controls.ts"],"names":[],"mappings":";;AAwCA,0DAsBC;AASD,sCA+BC;AA9FD;;;;;;;G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