@aroman22/codegraph-vba-darwin-arm64 1.15.0 → 1.17.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/lib/dist/bin/codegraph.js +13 -7
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/daemon-release.d.ts +7 -0
- package/lib/dist/bin/daemon-release.d.ts.map +1 -0
- package/lib/dist/bin/daemon-release.js +18 -0
- package/lib/dist/bin/daemon-release.js.map +1 -0
- package/lib/dist/db/queries.d.ts +41 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +78 -1
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/access-erd-extractor.d.ts +57 -0
- package/lib/dist/extraction/access-erd-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/access-erd-extractor.js +389 -0
- package/lib/dist/extraction/access-erd-extractor.js.map +1 -0
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/grammars.d.ts +20 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +34 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +1 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +371 -351
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +8 -3
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +1 -2
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +7 -6
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.d.ts +16 -14
- package/lib/dist/extraction/sql-query-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.js +43 -31
- package/lib/dist/extraction/sql-query-extractor.js.map +1 -1
- package/lib/dist/extraction/sql-table-scan.d.ts +184 -0
- package/lib/dist/extraction/sql-table-scan.d.ts.map +1 -0
- package/lib/dist/extraction/sql-table-scan.js +288 -0
- package/lib/dist/extraction/sql-table-scan.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +10 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +34 -3
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +2 -7
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +144 -90
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/calls.d.ts +24 -4
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/calls.js +42 -12
- package/lib/dist/extraction/vba/calls.js.map +1 -1
- package/lib/dist/extraction/vba/constants.d.ts +7 -14
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -1
- package/lib/dist/extraction/vba/constants.js +8 -36
- package/lib/dist/extraction/vba/constants.js.map +1 -1
- package/lib/dist/extraction/vba/context.d.ts +443 -7
- package/lib/dist/extraction/vba/context.d.ts.map +1 -1
- package/lib/dist/extraction/vba/context.js +325 -29
- package/lib/dist/extraction/vba/context.js.map +1 -1
- package/lib/dist/extraction/vba/controls.d.ts +18 -1
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/controls.js +99 -27
- package/lib/dist/extraction/vba/controls.js.map +1 -1
- package/lib/dist/extraction/vba/declarations.d.ts +1 -6
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -1
- package/lib/dist/extraction/vba/declarations.js +5 -39
- package/lib/dist/extraction/vba/declarations.js.map +1 -1
- package/lib/dist/extraction/vba/dims.d.ts +11 -7
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -1
- package/lib/dist/extraction/vba/dims.js +265 -29
- package/lib/dist/extraction/vba/dims.js.map +1 -1
- package/lib/dist/extraction/vba/docmd.d.ts +29 -2
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -1
- package/lib/dist/extraction/vba/docmd.js +297 -18
- package/lib/dist/extraction/vba/docmd.js.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.d.ts +7 -14
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.js +11 -45
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -1
- package/lib/dist/extraction/vba/error-channel.d.ts +57 -0
- package/lib/dist/extraction/vba/error-channel.d.ts.map +1 -0
- package/lib/dist/extraction/vba/error-channel.js +128 -0
- package/lib/dist/extraction/vba/error-channel.js.map +1 -0
- package/lib/dist/extraction/vba/errors.d.ts +64 -0
- package/lib/dist/extraction/vba/errors.d.ts.map +1 -0
- package/lib/dist/extraction/vba/errors.js +775 -0
- package/lib/dist/extraction/vba/errors.js.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts +23 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.js +70 -0
- package/lib/dist/extraction/vba/filesystem-statements.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +1 -6
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -1
- package/lib/dist/extraction/vba/implements.js +1 -22
- package/lib/dist/extraction/vba/implements.js.map +1 -1
- package/lib/dist/extraction/vba/labels.d.ts +26 -0
- package/lib/dist/extraction/vba/labels.d.ts.map +1 -0
- package/lib/dist/extraction/vba/labels.js +180 -0
- package/lib/dist/extraction/vba/labels.js.map +1 -0
- package/lib/dist/extraction/vba/module-vars.d.ts +36 -0
- package/lib/dist/extraction/vba/module-vars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/module-vars.js +145 -0
- package/lib/dist/extraction/vba/module-vars.js.map +1 -0
- package/lib/dist/extraction/vba/options.d.ts +88 -0
- package/lib/dist/extraction/vba/options.d.ts.map +1 -0
- package/lib/dist/extraction/vba/options.js +39 -0
- package/lib/dist/extraction/vba/options.js.map +1 -0
- package/lib/dist/extraction/vba/parameters.d.ts +35 -0
- package/lib/dist/extraction/vba/parameters.d.ts.map +1 -0
- package/lib/dist/extraction/vba/parameters.js +110 -0
- package/lib/dist/extraction/vba/parameters.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +1 -9
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -1
- package/lib/dist/extraction/vba/procedures.js +174 -112
- package/lib/dist/extraction/vba/procedures.js.map +1 -1
- package/lib/dist/extraction/vba/rules.d.ts +10 -5
- package/lib/dist/extraction/vba/rules.d.ts.map +1 -1
- package/lib/dist/extraction/vba/rules.js +19 -0
- package/lib/dist/extraction/vba/rules.js.map +1 -1
- package/lib/dist/extraction/vba/runtime-objects.d.ts +59 -0
- package/lib/dist/extraction/vba/runtime-objects.d.ts.map +1 -0
- package/lib/dist/extraction/vba/runtime-objects.js +106 -0
- package/lib/dist/extraction/vba/runtime-objects.js.map +1 -0
- package/lib/dist/extraction/vba/signature.d.ts +57 -0
- package/lib/dist/extraction/vba/signature.d.ts.map +1 -0
- package/lib/dist/extraction/vba/signature.js +164 -0
- package/lib/dist/extraction/vba/signature.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +76 -3
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -1
- package/lib/dist/extraction/vba/sql-wrapper.js +725 -151
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -1
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -1
- package/lib/dist/extraction/vba/tempvars.js +4 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -1
- package/lib/dist/extraction/vba/text-utils.d.ts +62 -2
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -1
- package/lib/dist/extraction/vba/text-utils.js +84 -6
- package/lib/dist/extraction/vba/text-utils.js.map +1 -1
- package/lib/dist/extraction/vba-extractor.d.ts +18 -1
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +111 -16
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.d.ts +28 -14
- package/lib/dist/extraction/vba-form-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.js +56 -21
- package/lib/dist/extraction/vba-form-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +89 -3
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +221 -57
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/vba-source.d.ts +0 -10
- package/lib/dist/extraction/vba-source.d.ts.map +1 -1
- package/lib/dist/extraction/vba-source.js +0 -13
- package/lib/dist/extraction/vba-source.js.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts +0 -6
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js +0 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js.map +1 -1
- package/lib/dist/graph/behavior-evidence.d.ts +162 -0
- package/lib/dist/graph/behavior-evidence.d.ts.map +1 -0
- package/lib/dist/graph/behavior-evidence.js +529 -0
- package/lib/dist/graph/behavior-evidence.js.map +1 -0
- package/lib/dist/index.d.ts +22 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +37 -1
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +7 -3
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +15 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +82 -7
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +557 -45
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.d.ts +12 -0
- package/lib/dist/mcp/daemon-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.js +37 -7
- package/lib/dist/mcp/daemon-watchdog.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +20 -1
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +123 -30
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +13 -2
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +32 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +163 -31
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +26 -4
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +12 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +92 -1
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +43 -2
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +86 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +47 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +160 -5
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +25 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +59 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.d.ts +11 -11
- package/lib/dist/resolution/vba-runtime-objects.d.ts.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.js +18 -38
- package/lib/dist/resolution/vba-runtime-objects.js.map +1 -1
- package/lib/dist/types.d.ts +13 -5
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +17 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/utils/backtrace-helpers.d.ts +14 -2
- package/lib/dist/utils/backtrace-helpers.d.ts.map +1 -1
- package/lib/dist/utils/backtrace-helpers.js +81 -7
- package/lib/dist/utils/backtrace-helpers.js.map +1 -1
- package/lib/dist/utils/sql-impact-helpers.d.ts.map +1 -1
- package/lib/dist/utils/sql-impact-helpers.js +119 -30
- package/lib/dist/utils/sql-impact-helpers.js.map +1 -1
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +3 -1
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RULES = void 0;
|
|
4
4
|
exports.createDimsClassifier = createDimsClassifier;
|
|
5
|
-
exports.sweepDimsAndWithEvents = sweepDimsAndWithEvents;
|
|
6
5
|
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
7
6
|
const constants_1 = require("./constants");
|
|
8
7
|
const rules_1 = require("./rules");
|
|
@@ -18,8 +17,24 @@ const rules_1 = require("./rules");
|
|
|
18
17
|
* `references` edge and `localVarTypeMap` registration as their `Dim`
|
|
19
18
|
* siblings today. The negative lookahead is unchanged: `Const` is still
|
|
20
19
|
* routed to `sweepEnumsAndConsts`.
|
|
20
|
+
* Issue #207: extend the negative lookahead with `Declare|Event|Enum|Type`
|
|
21
|
+
* so the four other header keywords that own their own sweeps are not
|
|
22
|
+
* misread as variable declarations. Before the fix:
|
|
23
|
+
* - `Private Declare PtrSafe Function Foo Lib "k32" (ByVal h As T) As Long`
|
|
24
|
+
* emitted a phantom `vba-name-resolution` edge to `T` and registered
|
|
25
|
+
* `h` in `localVarTypeMap` (the map has no procedure scope — #205
|
|
26
|
+
* territory — so a param name that collides with a real local
|
|
27
|
+
* silently changes that local's call-emission behavior).
|
|
28
|
+
* - `Public Event SomethingHappened(ByVal payload As T)` emitted a
|
|
29
|
+
* phantom edge to `T` and registered `payload` in the map.
|
|
30
|
+
* - `Public Enum Foo` / `Public Type Foo` registered the keyword itself
|
|
31
|
+
* (`Enum` / `Type`) in the map via `BARE_DIM_VAR_RE`.
|
|
32
|
+
* Each header has its own classifier (`dll-declare`, `event-decl`,
|
|
33
|
+
* `type-start`, plus `sweepEnumsAndConsts` for `Enum`) — they own the
|
|
34
|
+
* registration, so excluding them here is the correct separation of
|
|
35
|
+
* concerns and prevents silent graph pollution.
|
|
21
36
|
*/
|
|
22
|
-
const DIM_DECL_PREFIX_RE = /^\s*(?:Dim|Private|Public|Global|Static)\s+(?!(?:Function|Sub|Property|Const|WithEvents)\b)/i;
|
|
37
|
+
const DIM_DECL_PREFIX_RE = /^\s*(?:Dim|Private|Public|Global|Static)\s+(?!(?:Function|Sub|Property|Const|WithEvents|Declare|Event|Enum|Type)\b)/i;
|
|
23
38
|
/**
|
|
24
39
|
* Globally scan all `identifier As [New] TypePart1[.TypePart2]` on a
|
|
25
40
|
* variable declaration line. Run with /g after confirming DIM_DECL_PREFIX_RE.
|
|
@@ -78,6 +93,150 @@ function isArrayDeclaration(line, variableName) {
|
|
|
78
93
|
const escaped = variableName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
79
94
|
return new RegExp(`\\b${escaped}\\s*\\(`, 'iu').test(line);
|
|
80
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Issue #251: modifier keywords that may precede a parameter name in a
|
|
98
|
+
* VBA procedure signature. They are skipped so `ByVal p_Codigo As String`
|
|
99
|
+
* yields `p_Codigo` rather than `ByVal`.
|
|
100
|
+
*/
|
|
101
|
+
const PARAM_MODIFIERS = new Set(['byval', 'byref', 'optional', 'paramarray']);
|
|
102
|
+
/**
|
|
103
|
+
* Issue #251: the declared parameter names of a procedure signature line.
|
|
104
|
+
*
|
|
105
|
+
* Only the names are wanted (types, defaults and array parens are all
|
|
106
|
+
* irrelevant to a shadow check), so the parser stays deliberately small:
|
|
107
|
+
* take the signature's own parenthesised span — the one that closes the
|
|
108
|
+
* first `(`, which on a colon-separated single-line procedure stops before
|
|
109
|
+
* the inline body — split it on commas, and from each chunk take the first
|
|
110
|
+
* identifier that is not a modifier keyword. A signature with no parameter
|
|
111
|
+
* list yields an empty array.
|
|
112
|
+
*
|
|
113
|
+
* A default value containing a comma (`Optional n As Long = 1`) cannot
|
|
114
|
+
* produce a wrong NAME: the comma split can only over-split a chunk, and an
|
|
115
|
+
* over-split chunk's first identifier belongs to the default expression,
|
|
116
|
+
* never to a new parameter. Over-registering a shadow name is the safe
|
|
117
|
+
* direction — at worst one genuine module-variable read goes unreported,
|
|
118
|
+
* which is the same silence the graph had before this issue.
|
|
119
|
+
*/
|
|
120
|
+
function parseParameterNames(line) {
|
|
121
|
+
const open = line.indexOf('(');
|
|
122
|
+
if (open < 0)
|
|
123
|
+
return [];
|
|
124
|
+
let depth = 0;
|
|
125
|
+
let close = -1;
|
|
126
|
+
for (let i = open; i < line.length; i++) {
|
|
127
|
+
const ch = line[i];
|
|
128
|
+
if (ch === '(')
|
|
129
|
+
depth++;
|
|
130
|
+
else if (ch === ')') {
|
|
131
|
+
depth--;
|
|
132
|
+
if (depth === 0) {
|
|
133
|
+
close = i;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (close <= open)
|
|
139
|
+
return [];
|
|
140
|
+
const names = [];
|
|
141
|
+
for (const chunk of line.slice(open + 1, close).split(',')) {
|
|
142
|
+
const identifiers = chunk.match(/\p{L}[\p{L}\p{N}_]*/gu);
|
|
143
|
+
if (!identifiers)
|
|
144
|
+
continue;
|
|
145
|
+
for (const identifier of identifiers) {
|
|
146
|
+
if (PARAM_MODIFIERS.has(identifier.toLowerCase()))
|
|
147
|
+
continue;
|
|
148
|
+
names.push(identifier);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return names;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Issue #251: the declaration keyword that opens a module-level
|
|
156
|
+
* declaration line (`Dim` / `Private` / `Public` / `Global` / `Static`),
|
|
157
|
+
* or the empty string for a bare `WithEvents m_X As Form_Y` line.
|
|
158
|
+
*/
|
|
159
|
+
const DECL_KEYWORD_RE = /^\s*(Dim|Private|Public|Global|Static)\b/i;
|
|
160
|
+
/**
|
|
161
|
+
* Issue #251: fold a module-level declaration keyword to the canonical
|
|
162
|
+
* visibility enum.
|
|
163
|
+
*
|
|
164
|
+
* This is deliberately NOT `foldVisibility` from `text-utils.ts`. That
|
|
165
|
+
* helper answers "what did the author write" for keywords that only ever
|
|
166
|
+
* appear as a visibility (`Public` / `Private` / `Friend` / `Global`) and
|
|
167
|
+
* folds everything it does not recognise to `'public'`. A variable
|
|
168
|
+
* declaration also accepts `Dim` and `Static`, and in the declarations
|
|
169
|
+
* section of a VBA module BOTH mean module-private — folding them to
|
|
170
|
+
* `'public'` would claim every `Dim gblFoo` is exported from its module.
|
|
171
|
+
* Only `Public` and `Global` export a module-level variable.
|
|
172
|
+
*/
|
|
173
|
+
function moduleVarVisibility(line) {
|
|
174
|
+
const keyword = (DECL_KEYWORD_RE.exec(line)?.[1] ?? '').toLowerCase();
|
|
175
|
+
return keyword === 'public' || keyword === 'global' ? 'public' : 'private';
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Issue #251: emit ONE `variable` node plus its module -> variable
|
|
179
|
+
* `contains` edge for a module-level declaration.
|
|
180
|
+
*
|
|
181
|
+
* Two gates, both load-bearing:
|
|
182
|
+
*
|
|
183
|
+
* 1. `ctx.currentVarTypeProcKey === 'module'` — procedure locals stay
|
|
184
|
+
* OUT of the graph. Every local of every procedure would be tens of
|
|
185
|
+
* thousands of nodes whose only consumer is the def-use analysis this
|
|
186
|
+
* project deliberately does not do; module-level state is the part
|
|
187
|
+
* that couples modules to one another, and therefore the part worth a
|
|
188
|
+
* node.
|
|
189
|
+
* 2. `ctx.moduleVariables` membership — a name re-declared on a later
|
|
190
|
+
* line, or reached through BOTH the typed loop and the bare-Dim
|
|
191
|
+
* fallback of the same emit, keeps its first node instead of gaining
|
|
192
|
+
* a duplicate.
|
|
193
|
+
*
|
|
194
|
+
* The `contains` edge goes through `pushContainsFromModule`, so it is
|
|
195
|
+
* parked on `pendingModuleOrClassSource` and re-pointed once `extract()`
|
|
196
|
+
* creates the module/class node after the walk.
|
|
197
|
+
*
|
|
198
|
+
* Returns 1 when a node was emitted, 0 otherwise, so the caller can fold
|
|
199
|
+
* the result into the rule's `count`: a file whose only symbols are
|
|
200
|
+
* module-level variables must still get a module node, for the same
|
|
201
|
+
* reason a Const-only `.bas` gets one.
|
|
202
|
+
*/
|
|
203
|
+
function emitModuleVariableNode(ctx, decl, line, lineNum) {
|
|
204
|
+
if (ctx.currentVarTypeProcKey !== 'module')
|
|
205
|
+
return 0;
|
|
206
|
+
if (!decl.name)
|
|
207
|
+
return 0;
|
|
208
|
+
const key = decl.name.toLowerCase();
|
|
209
|
+
if (ctx.moduleVariables.has(key))
|
|
210
|
+
return 0;
|
|
211
|
+
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'variable', decl.name, lineNum);
|
|
212
|
+
ctx.nodes.push({
|
|
213
|
+
id: nodeId,
|
|
214
|
+
kind: 'variable',
|
|
215
|
+
name: decl.name,
|
|
216
|
+
qualifiedName: ctx.moduleName ? `${ctx.moduleName}.${decl.name}` : decl.name,
|
|
217
|
+
filePath: ctx.filePath,
|
|
218
|
+
language: 'vba',
|
|
219
|
+
startLine: lineNum,
|
|
220
|
+
endLine: lineNum,
|
|
221
|
+
startColumn: 0,
|
|
222
|
+
endColumn: line.length,
|
|
223
|
+
visibility: moduleVarVisibility(line),
|
|
224
|
+
metadata: {
|
|
225
|
+
declaredType: decl.declaredType,
|
|
226
|
+
isArray: decl.isArray,
|
|
227
|
+
isWithEvents: decl.isWithEvents,
|
|
228
|
+
// Module-level `Const` declarations are owned by the enum/const
|
|
229
|
+
// classifier, which emits a `constant` node for them. The flag is
|
|
230
|
+
// stamped `false` here so a consumer reading `variable` nodes never
|
|
231
|
+
// has to know that and can filter on a single field.
|
|
232
|
+
isConst: false,
|
|
233
|
+
},
|
|
234
|
+
updatedAt: Date.now(),
|
|
235
|
+
});
|
|
236
|
+
ctx.pushContainsFromModule(nodeId);
|
|
237
|
+
ctx.moduleVariables.set(key, { name: decl.name, nodeId });
|
|
238
|
+
return 1;
|
|
239
|
+
}
|
|
81
240
|
/**
|
|
82
241
|
* Issue #153: the declarative rule table for the Dim / WithEvents
|
|
83
242
|
* concern. Two rules:
|
|
@@ -109,13 +268,20 @@ exports.RULES = [
|
|
|
109
268
|
id: 'dim-decl',
|
|
110
269
|
description: 'Match a `Dim|Private|Public|Global|Static <var> [As [New] <Type>][, …]` declaration; populate `localVarTypeMap` and emit one `vba-name-resolution` `references` edge per non-primitive type (or per qualified outer type).',
|
|
111
270
|
pattern: DIM_DECL_PREFIX_RE,
|
|
112
|
-
count: (result) =>
|
|
271
|
+
count: (result) => {
|
|
272
|
+
// Issue #251: module-level `variable` nodes count as symbols, so a
|
|
273
|
+
// `.bas` whose only content is a declarations section still reaches
|
|
274
|
+
// `hasAnySymbols` and gets its module node.
|
|
275
|
+
const { edges, variables } = result;
|
|
276
|
+
return edges + variables;
|
|
277
|
+
},
|
|
113
278
|
emit: (_m, ctx, line, lineNum) => {
|
|
114
279
|
// Re-run the prefix check inside the emit (the pattern is a
|
|
115
280
|
// RegExp without /g so `.test()` is enough and idempotent). This
|
|
116
281
|
// keeps the rule table's contract "pattern matches → emit fires"
|
|
117
282
|
// while the emit body is the same code that used to live inline.
|
|
118
283
|
let edgesEmitted = 0;
|
|
284
|
+
let variablesEmitted = 0;
|
|
119
285
|
if (!DIM_DECL_PREFIX_RE.test(line))
|
|
120
286
|
return null;
|
|
121
287
|
DIM_ALL_VARS_RE.lastIndex = 0;
|
|
@@ -132,12 +298,28 @@ exports.RULES = [
|
|
|
132
298
|
const innerType = m[4] ?? m[5] ?? '';
|
|
133
299
|
// Fix 2 (Issue #2): populate the local var type map so that
|
|
134
300
|
// `sweepCallsAndSql` can gate qualified statement-form calls.
|
|
301
|
+
// Issue #205: the write is scoped to the current procedure's
|
|
302
|
+
// bucket (or `'module'` when no procedure is open) — see
|
|
303
|
+
// `currentVarTypeProcKey` on the context.
|
|
135
304
|
if (varName && outerType) {
|
|
136
|
-
ctx.
|
|
305
|
+
ctx.setLocalVarTypeInScope(ctx.currentVarTypeProcKey, varName, {
|
|
137
306
|
outer: outerType,
|
|
138
307
|
qualified: !!innerType,
|
|
139
308
|
isArray: isArrayDeclaration(line, varName),
|
|
140
309
|
});
|
|
310
|
+
// Issue #251: a procedure-local declaration shadows a
|
|
311
|
+
// module-level variable of the same name, so the read/write
|
|
312
|
+
// scan must know this procedure owns the name.
|
|
313
|
+
ctx.declareProcLocalName(ctx.currentVarTypeProcKey, varName);
|
|
314
|
+
// Issue #251: module-level declarations additionally become a
|
|
315
|
+
// `variable` node. `Dim x As Long` inside a Sub does not — the
|
|
316
|
+
// gate lives inside `emitModuleVariableNode`.
|
|
317
|
+
variablesEmitted += emitModuleVariableNode(ctx, {
|
|
318
|
+
name: varName,
|
|
319
|
+
declaredType: innerType ? `${outerType}.${innerType}` : outerType,
|
|
320
|
+
isArray: isArrayDeclaration(line, varName),
|
|
321
|
+
isWithEvents: false,
|
|
322
|
+
}, line, lineNum);
|
|
141
323
|
}
|
|
142
324
|
if (innerType) {
|
|
143
325
|
// Qualified form (`Dim x As Foo.Bar`) — emit reference to the
|
|
@@ -172,22 +354,44 @@ exports.RULES = [
|
|
|
172
354
|
if (bm) {
|
|
173
355
|
const varName = bm[1] ?? '';
|
|
174
356
|
if (varName) {
|
|
175
|
-
|
|
176
|
-
|
|
357
|
+
// Issue #205: the existing-key check is scoped to the
|
|
358
|
+
// CURRENT procedure's bucket via `lookupLocalVarType`
|
|
359
|
+
// (proc-bucket first, then module-bucket). Without the
|
|
360
|
+
// scoping, a bare `Dim x` inside a procedure would NOT
|
|
361
|
+
// register when a MODULE-LEVEL `Dim x` exists, which is
|
|
362
|
+
// wrong — the proc-local declaration should win inside
|
|
363
|
+
// the proc.
|
|
364
|
+
// Issue #251: the shadow registration is UNCONDITIONAL — unlike
|
|
365
|
+
// the type-map write below, which yields to an outer declaration
|
|
366
|
+
// of the same name. `Dim codigo` inside a Sub declares a local
|
|
367
|
+
// whether or not the module also declares `codigo`; that is
|
|
368
|
+
// precisely the case the read/write scan must stay silent on.
|
|
369
|
+
ctx.declareProcLocalName(ctx.currentVarTypeProcKey, varName);
|
|
370
|
+
if (!ctx.lookupLocalVarType(varName)) {
|
|
177
371
|
// Look for an `As <Type>` continuation on the same line so the
|
|
178
372
|
// outer type matches the existing typed-form behaviour. If
|
|
179
373
|
// absent, the variable is implicit `Variant` per VBA semantics.
|
|
180
374
|
const asMatch = DIM_AS_TYPE_RE.exec(line);
|
|
181
375
|
const outer = asMatch ? (asMatch[1] ?? '').toLowerCase() : 'variant';
|
|
182
|
-
ctx.
|
|
376
|
+
ctx.setLocalVarTypeInScope(ctx.currentVarTypeProcKey, varName, {
|
|
183
377
|
outer,
|
|
184
378
|
qualified: false,
|
|
185
379
|
isArray: isArrayDeclaration(line, varName),
|
|
186
380
|
});
|
|
381
|
+
variablesEmitted += emitModuleVariableNode(ctx, {
|
|
382
|
+
name: varName,
|
|
383
|
+
// Source-cased so the node reports what the author wrote;
|
|
384
|
+
// the type map's lowercase form is a lookup key, not a
|
|
385
|
+
// display value. An `As`-less declaration is `Variant` per
|
|
386
|
+
// VBA semantics.
|
|
387
|
+
declaredType: asMatch ? (asMatch[1] ?? 'Variant') : 'Variant',
|
|
388
|
+
isArray: isArrayDeclaration(line, varName),
|
|
389
|
+
isWithEvents: false,
|
|
390
|
+
}, line, lineNum);
|
|
187
391
|
}
|
|
188
392
|
}
|
|
189
393
|
}
|
|
190
|
-
return { edges: edgesEmitted };
|
|
394
|
+
return { edges: edgesEmitted, variables: variablesEmitted };
|
|
191
395
|
},
|
|
192
396
|
}),
|
|
193
397
|
(0, rules_1.defineRule)({
|
|
@@ -202,12 +406,27 @@ exports.RULES = [
|
|
|
202
406
|
const weVarM = WITHEVENTS_VAR_RE.exec(line);
|
|
203
407
|
const weVarName = weVarM?.[1] ?? '';
|
|
204
408
|
if (weVarName) {
|
|
205
|
-
|
|
409
|
+
// Issue #205: write to the current procedure's bucket so a
|
|
410
|
+
// `WithEvents` field in `Form_Foo` does not pollute the
|
|
411
|
+
// `'module'` bucket's `weVarName` key for sibling forms or
|
|
412
|
+
// unrelated code.
|
|
413
|
+
ctx.setLocalVarTypeInScope(ctx.currentVarTypeProcKey, weVarName, {
|
|
206
414
|
outer: formType,
|
|
207
415
|
qualified: false,
|
|
208
416
|
withEvents: true,
|
|
209
417
|
variableName: weVarName,
|
|
210
418
|
});
|
|
419
|
+
ctx.declareProcLocalName(ctx.currentVarTypeProcKey, weVarName);
|
|
420
|
+
// Issue #251: a `WithEvents` field is module-level state like any
|
|
421
|
+
// other declaration and gets the same `variable` node, flagged so
|
|
422
|
+
// a consumer can tell an event sink from a plain field. The
|
|
423
|
+
// `references` + `subscribes-event` edges below are untouched.
|
|
424
|
+
emitModuleVariableNode(ctx, {
|
|
425
|
+
name: weVarName,
|
|
426
|
+
declaredType: formType,
|
|
427
|
+
isArray: false,
|
|
428
|
+
isWithEvents: true,
|
|
429
|
+
}, line, lineNum);
|
|
211
430
|
}
|
|
212
431
|
// Stamp `variableName` onto the `references` edge's metadata so
|
|
213
432
|
// the post-extraction event-handler synthesis pass (#150) can
|
|
@@ -249,36 +468,53 @@ exports.RULES = [
|
|
|
249
468
|
* rules are independent: `dim-decl` handles typed declarations
|
|
250
469
|
* (REJECTED if the line is a `WithEvents` because the prefix
|
|
251
470
|
* negative-lookahead excludes `WithEvents`), `withevents-decl`
|
|
252
|
-
* handles WithEvents.
|
|
471
|
+
* handles WithEvents.
|
|
472
|
+
*
|
|
473
|
+
* Issue #205: the classifier maintains a closure-local proc stack
|
|
474
|
+
* (parallel to the calls-sweep's `ctx.procStack` in
|
|
475
|
+
* `call-sweep.ts:213`) and writes the top of that stack into
|
|
476
|
+
* `ctx.currentVarTypeProcKey` so `localVarTypeMap` writes are scoped
|
|
477
|
+
* to the procedure whose body the `Dim` is inside (or `'module'`
|
|
478
|
+
* when no procedure is open). The two stacks track the same
|
|
479
|
+
* `PROC_RE` / `PROCEDURE_END_RE` boundaries so they stay in sync at
|
|
480
|
+
* every line.
|
|
253
481
|
*/
|
|
254
482
|
function createDimsClassifier() {
|
|
483
|
+
// Issue #205: per-instance proc stack. Holds the `startLine` of
|
|
484
|
+
// every procedure whose `End Sub`/`End Function`/`End Property`
|
|
485
|
+
// the classifier has not yet seen. Initialized empty so module-
|
|
486
|
+
// level `Dim`s write to the `'module'` bucket.
|
|
487
|
+
const stack = [];
|
|
255
488
|
return {
|
|
256
489
|
name: 'dims',
|
|
257
490
|
count: 0,
|
|
258
491
|
classifyLine(line, i, ctx) {
|
|
259
492
|
const lineNum = i + 1;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
493
|
+
// Issue #205: track proc scope BEFORE rule dispatch so a
|
|
494
|
+
// `Dim x As Y` declaration on the same line as `Sub Foo()` is
|
|
495
|
+
// written to the `'module'` bucket (the proc isn't open yet
|
|
496
|
+
// at that point — VBA declares inside the proc, but a `Sub`
|
|
497
|
+
// line is not a `Dim` line, so the gate is theoretical; we
|
|
498
|
+
// still process the line as a proc start first to mirror the
|
|
499
|
+
// call-sweep's order).
|
|
500
|
+
const procStart = constants_1.PROC_RE.exec(line);
|
|
501
|
+
if (procStart) {
|
|
502
|
+
stack.push(lineNum);
|
|
503
|
+
ctx.currentVarTypeProcKey = String(lineNum);
|
|
504
|
+
// Issue #251: a parameter shadows a module-level variable of the
|
|
505
|
+
// same name for the whole procedure body, exactly like a `Dim`
|
|
506
|
+
// does, so the names are registered on the same shadow bucket.
|
|
507
|
+
for (const paramName of parseParameterNames(line)) {
|
|
508
|
+
ctx.declareProcLocalName(ctx.currentVarTypeProcKey, paramName);
|
|
267
509
|
}
|
|
268
510
|
}
|
|
511
|
+
else if (constants_1.PROCEDURE_END_RE.test(line) && stack.length > 0) {
|
|
512
|
+
stack.pop();
|
|
513
|
+
ctx.currentVarTypeProcKey =
|
|
514
|
+
stack.length > 0 ? String(stack[stack.length - 1]) : 'module';
|
|
515
|
+
}
|
|
516
|
+
this.count += (0, rules_1.runRules)(exports.RULES, ctx, line, line, lineNum, {});
|
|
269
517
|
},
|
|
270
518
|
};
|
|
271
519
|
}
|
|
272
|
-
/**
|
|
273
|
-
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
274
|
-
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
275
|
-
*/
|
|
276
|
-
function sweepDimsAndWithEvents(ctx, src) {
|
|
277
|
-
const cls = createDimsClassifier();
|
|
278
|
-
const lines = src.split('\n');
|
|
279
|
-
for (let i = 0; i < lines.length; i++) {
|
|
280
|
-
cls.classifyLine(lines[i] ?? '', i, ctx);
|
|
281
|
-
}
|
|
282
|
-
return cls.count;
|
|
283
|
-
}
|
|
284
520
|
//# sourceMappingURL=dims.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dims.js","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dims.js","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":";;;AA+gBA,oDAoCC;AA5iBD,gEA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AC,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3D,KAAK,CAAC,GAAG,EAAE,CAAC;gBACZ,GAAG,CAAC,qBAAqB;oBACvB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YAClE,CAAC;YACD,IAAI,CAAC,KAAK,IAAI,IAAA,gBAAQ,EAAC,aAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,12 +5,39 @@ import { VbaExtractorContext, ProcInfo } from './context';
|
|
|
5
5
|
* a cached stub node (form-layout / report-layout) and an
|
|
6
6
|
* `opens-form` / `opens-report` heuristic edge from the calling Sub.
|
|
7
7
|
*/
|
|
8
|
-
export declare function scanDoCmdOpenCalls(ctx: VbaExtractorContext, line: string, caller: ProcInfo, lineNum: number): void;
|
|
8
|
+
export declare function scanDoCmdOpenCalls(ctx: VbaExtractorContext, line: string, maskedLine: string, caller: ProcInfo, lineNum: number): void;
|
|
9
9
|
/**
|
|
10
10
|
* Issue #48: scan one line of VBA source for `DoCmd.OpenQuery "X"` calls.
|
|
11
11
|
* Each match emits ONE `UnresolvedReference` (NOT a stub + edge) so the
|
|
12
12
|
* resolver binds to the REAL `query` node that `SqlQueryExtractor`
|
|
13
13
|
* produces for `queries/<Name>.sql`, tagged `synthesizedBy: 'vba-opens-query'`.
|
|
14
14
|
*/
|
|
15
|
-
export declare function scanDoCmdOpenQuery(ctx: VbaExtractorContext, line: string, caller: ProcInfo, lineNum: number): void;
|
|
15
|
+
export declare function scanDoCmdOpenQuery(ctx: VbaExtractorContext, line: string, maskedLine: string, caller: ProcInfo, lineNum: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* Issue #246 (task T4): scan one line of VBA source for
|
|
18
|
+
* `DoCmd.Close acForm|acReport, "<Name>"`.
|
|
19
|
+
*
|
|
20
|
+
* Each match emits ONE `references` edge -- not a new edge kind -- from the
|
|
21
|
+
* calling procedure to the very same `form-layout` / `report-layout` stub
|
|
22
|
+
* that `opens-form` / `opens-report` already point at, by reusing
|
|
23
|
+
* `resolveOpensStubId`'s cache. A form that is both opened and closed
|
|
24
|
+
* therefore ends up with ONE node carrying two distinct edges.
|
|
25
|
+
*
|
|
26
|
+
* The edge carries `synthesizedBy: 'vba-closes-form'` for both object types
|
|
27
|
+
* (one tag for the whole verb keeps every close edge queryable as a set) and
|
|
28
|
+
* `targetFormName` as its single name key, for the same reason. If a
|
|
29
|
+
* first-class `closes-form` edge kind is ever wanted, that tag is the seam.
|
|
30
|
+
*/
|
|
31
|
+
export declare function scanDoCmdCloseCalls(ctx: VbaExtractorContext, line: string, maskedLine: string, caller: ProcInfo, lineNum: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Issue #254: scan one line of VBA source for every `DoCmd` verb in
|
|
34
|
+
* `DOCMD_OBJECT_DISPATCH`. Each match whose object argument resolves to a
|
|
35
|
+
* static name emits ONE `UnresolvedReference` — no node, ever.
|
|
36
|
+
*
|
|
37
|
+
* `maskedLine` has string CONTENT blanked out, so the `docmd` prefix check
|
|
38
|
+
* rejects a verb name that only appears inside a string literal. The object
|
|
39
|
+
* name itself lives inside a literal, which is why the split runs on the
|
|
40
|
+
* original `line`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function scanDoCmdObjectCalls(ctx: VbaExtractorContext, line: string, maskedLine: string, caller: ProcInfo, lineNum: number): void;
|
|
16
43
|
//# sourceMappingURL=docmd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docmd.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docmd.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAoG1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAqBN;AAsFD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAuBN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAgCN;AAgLD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAmCN"}
|