@aroman22/codegraph-vba-darwin-arm64 1.14.0 → 1.16.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 +30 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +51 -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/index.d.ts.map +1 -1
- package/lib/dist/index.js +9 -0
- 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/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +29 -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/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical list of VBA/Access runtime objects and singletons whose
|
|
4
|
+
* `Receiver.Member` calls are NEVER user-defined code — DAO, FileSystemObject
|
|
5
|
+
* (`fso`), intrinsic collections, error/debug intrinsics, late-binding
|
|
6
|
+
* factories, and Access application singletons.
|
|
7
|
+
*
|
|
8
|
+
* Issue #245: this used to be TWO literal sets written at different times.
|
|
9
|
+
* `RUNTIME_OBJECTS` (formerly in `src/resolution/vba-runtime-objects.ts`)
|
|
10
|
+
* decided whether a synthetic call EDGE was stamped `declined-runtime`;
|
|
11
|
+
* `RUNTIME_RECEIVER_BLACKLIST` (formerly a second literal in
|
|
12
|
+
* `./constants.ts`) decided whether the call-site scan looked at a receiver
|
|
13
|
+
* at all. Because the second list omitted `VBA`, `fso`, `Collection`,
|
|
14
|
+
* `ListBox` and friends, the extractor still synthesized a `function` NODE
|
|
15
|
+
* for every one of those calls — 6,132 stub nodes against 3,840 real
|
|
16
|
+
* procedures on the reference corpus. Edge consumers can filter on
|
|
17
|
+
* `repointDecision`; symbol search and node counts cannot.
|
|
18
|
+
*
|
|
19
|
+
* The two sets are now one literal (`RUNTIME_OBJECT_DEFS`) with two derived
|
|
20
|
+
* views, so they can never drift apart again:
|
|
21
|
+
*
|
|
22
|
+
* - `RUNTIME_OBJECTS` — every canonical name, lowercased, for the
|
|
23
|
+
* case-insensitive `isRuntimeObject` predicate. Consumed by the
|
|
24
|
+
* post-extraction stub resolver (`ReferenceResolver.resolveVbaCallStubTarget`)
|
|
25
|
+
* to DECLINE repointing a stub whose receiver is a runtime object, and by
|
|
26
|
+
* the extractor's stub-NODE gate in `./calls.ts`.
|
|
27
|
+
* - `RUNTIME_RECEIVER_BLACKLIST` — the case-sensitive PascalCase subset
|
|
28
|
+
* flagged `blocksCallScan`. These receivers/members are dropped by the
|
|
29
|
+
* call-site scans BEFORE any reference is surfaced, so the set is
|
|
30
|
+
* deliberately narrow: widening it would silently delete
|
|
31
|
+
* `unresolved_refs` rows. Widening the canonical set is safe; promoting
|
|
32
|
+
* an entry to `blocksCallScan` is not.
|
|
33
|
+
*
|
|
34
|
+
* A user class or module that happens to share a runtime-object name (a
|
|
35
|
+
* "shadow" declaration, e.g. a user `.cls` literally named `DAO`) is still
|
|
36
|
+
* linked by the resolver: it runs its normal two-step name resolution FIRST
|
|
37
|
+
* and only falls back to this list when no real target exists (FR-2.1).
|
|
38
|
+
*
|
|
39
|
+
* This module is a LEAF: it imports nothing. `src/extraction/` must not
|
|
40
|
+
* depend on `src/resolution/`, so the canonical set lives here and
|
|
41
|
+
* `src/resolution/vba-runtime-objects.ts` re-exports it — every existing
|
|
42
|
+
* resolver import keeps working unchanged.
|
|
43
|
+
*/
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.RUNTIME_RECEIVER_BLACKLIST = exports.RUNTIME_OBJECTS = void 0;
|
|
46
|
+
exports.isRuntimeObject = isRuntimeObject;
|
|
47
|
+
/** THE single literal. Both exported sets below are views over it. */
|
|
48
|
+
const RUNTIME_OBJECT_DEFS = [
|
|
49
|
+
// Access application singletons.
|
|
50
|
+
{ name: 'Application', blocksCallScan: true },
|
|
51
|
+
{ name: 'DoCmd', blocksCallScan: true },
|
|
52
|
+
{ name: 'SysCmd', blocksCallScan: true },
|
|
53
|
+
{ name: 'Screen', blocksCallScan: true },
|
|
54
|
+
// Access object collections.
|
|
55
|
+
{ name: 'Forms', blocksCallScan: true },
|
|
56
|
+
{ name: 'Reports', blocksCallScan: true },
|
|
57
|
+
{ name: 'Modules', blocksCallScan: true },
|
|
58
|
+
{ name: 'References', blocksCallScan: true },
|
|
59
|
+
{ name: 'CommandBars', blocksCallScan: true },
|
|
60
|
+
// VBA debugging / error-handling intrinsics.
|
|
61
|
+
{ name: 'Debug', blocksCallScan: true },
|
|
62
|
+
{ name: 'Err', blocksCallScan: true },
|
|
63
|
+
// Late-binding factories (return IDispatch — not user code).
|
|
64
|
+
{ name: 'CreateObject', blocksCallScan: true },
|
|
65
|
+
{ name: 'GetObject', blocksCallScan: true },
|
|
66
|
+
// DAO/ADO recordset field collection access (e.g. rcdDatos.Fields("ID")).
|
|
67
|
+
{ name: 'Fields', blocksCallScan: true },
|
|
68
|
+
// Data-access libraries and the current-database singletons.
|
|
69
|
+
{ name: 'DAO' },
|
|
70
|
+
{ name: 'CurrentDb' },
|
|
71
|
+
{ name: 'CurrentProject' },
|
|
72
|
+
{ name: 'CodeData' },
|
|
73
|
+
{ name: 'CodeProject' },
|
|
74
|
+
// Scripting runtime.
|
|
75
|
+
{ name: 'fso' },
|
|
76
|
+
// The VBA library namespace itself — `VBA.DoEvents`, `VBA.Format`, ...
|
|
77
|
+
{ name: 'VBA' },
|
|
78
|
+
// Intrinsic collection type.
|
|
79
|
+
{ name: 'Collection' },
|
|
80
|
+
// Access control types used as declared local-variable types.
|
|
81
|
+
{ name: 'ListBox' },
|
|
82
|
+
{ name: 'ComboBox' },
|
|
83
|
+
{ name: 'TextBox' },
|
|
84
|
+
];
|
|
85
|
+
/**
|
|
86
|
+
* Every canonical runtime-object name, lowercased so matching is
|
|
87
|
+
* case-insensitive against a receiver as it appears in source.
|
|
88
|
+
*/
|
|
89
|
+
exports.RUNTIME_OBJECTS = new Set(RUNTIME_OBJECT_DEFS.map((def) => def.name.toLowerCase()));
|
|
90
|
+
/**
|
|
91
|
+
* Derived view: the case-sensitive receivers/members the call-site scans drop
|
|
92
|
+
* before surfacing anything. NOT a second literal — see `blocksCallScan`.
|
|
93
|
+
*/
|
|
94
|
+
exports.RUNTIME_RECEIVER_BLACKLIST = new Set(RUNTIME_OBJECT_DEFS.filter((def) => def.blocksCallScan).map((def) => def.name));
|
|
95
|
+
/**
|
|
96
|
+
* True iff `receiver` (any case) names a known VBA/Access runtime object.
|
|
97
|
+
* Leading/trailing brackets and surrounding whitespace are stripped
|
|
98
|
+
* defensively so a bracketed receiver (`[DAO]`) still matches.
|
|
99
|
+
*/
|
|
100
|
+
function isRuntimeObject(receiver) {
|
|
101
|
+
if (!receiver)
|
|
102
|
+
return false;
|
|
103
|
+
const key = receiver.replace(/^\[/, '').replace(/\]$/, '').trim().toLowerCase();
|
|
104
|
+
return exports.RUNTIME_OBJECTS.has(key);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=runtime-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-objects.js","sourceRoot":"","sources":["../../../src/extraction/vba/runtime-objects.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;AA+EH,0CAIC;AAhED,sEAAsE;AACtE,MAAM,mBAAmB,GAAgC;IACvD,iCAAiC;IACjC,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE;IAC7C,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;IACvC,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE;IACxC,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE;IACxC,6BAA6B;IAC7B,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;IACvC,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE;IACzC,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE;IACzC,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE;IAC5C,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE;IAC7C,6CAA6C;IAC7C,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;IACvC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAA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AO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChF,OAAO,uBAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue #250 (task T8): parse a VBA procedure's parameter list off its
|
|
3
|
+
* declaration line.
|
|
4
|
+
*
|
|
5
|
+
* The line handed in here has already been through the preprocessor, so a
|
|
6
|
+
* signature split with `_` continuations arrives as ONE logical line and a
|
|
7
|
+
* trailing `'` comment is already gone. This module must never re-implement
|
|
8
|
+
* continuation joining — see `vba-preprocess.ts` and issue #202.
|
|
9
|
+
*/
|
|
10
|
+
/** One declared parameter of a `Sub` / `Function` / `Property` signature. */
|
|
11
|
+
export interface VbaParameterInfo {
|
|
12
|
+
/** Declared name, original casing, brackets unwrapped. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** The `As <Type>` type, or `null` for an implicitly-`Variant` parameter. */
|
|
15
|
+
type: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* `true` unless the declaration says `ByVal`. VBA passes by reference by
|
|
18
|
+
* default, so an unqualified parameter really is a `ByRef` one.
|
|
19
|
+
*/
|
|
20
|
+
byRef: boolean;
|
|
21
|
+
/** The literal `Optional` keyword was present. */
|
|
22
|
+
optional: boolean;
|
|
23
|
+
/** Declared as an array — `name()`. */
|
|
24
|
+
isArray: boolean;
|
|
25
|
+
/** An `= <default>` clause was present. */
|
|
26
|
+
hasDefault: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Declared arity. `total` is `null` — not `Infinity` — when the signature ends
|
|
30
|
+
* in a `ParamArray`, because this value is serialised into node metadata and
|
|
31
|
+
* crosses the parse-worker boundary, and JSON has no `Infinity`.
|
|
32
|
+
*/
|
|
33
|
+
export interface VbaArity {
|
|
34
|
+
required: number;
|
|
35
|
+
total: number | null;
|
|
36
|
+
}
|
|
37
|
+
/** The parsed shape of one procedure signature. */
|
|
38
|
+
export interface VbaSignatureInfo {
|
|
39
|
+
params: VbaParameterInfo[];
|
|
40
|
+
arity: VbaArity;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Split a parameter-list body on its top-level commas. Depth- and
|
|
44
|
+
* string-aware, so `Optional s As String = "a,b"` stays one entry.
|
|
45
|
+
*/
|
|
46
|
+
export declare function splitParameterList(body: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Parse the signature of the procedure whose name ends at `nameEndIndex`.
|
|
49
|
+
*
|
|
50
|
+
* A `ParamArray` tail is excluded from `arity.required` (it accepts zero
|
|
51
|
+
* arguments) and forces `arity.total` to `null` (it accepts any number). The
|
|
52
|
+
* `ParamArray` parameter itself is still reported in `params` with
|
|
53
|
+
* `optional: false`, because that flag mirrors the literal `Optional` keyword
|
|
54
|
+
* — which VBA forbids on a `ParamArray`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseSignature(line: string, nameEndIndex: number): VbaSignatureInfo;
|
|
57
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,EAAE,QAAQ,CAAC;CACjB;AA0DD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBzD;AAmCD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GACnB,gBAAgB,CAmBlB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Issue #250 (task T8): parse a VBA procedure's parameter list off its
|
|
4
|
+
* declaration line.
|
|
5
|
+
*
|
|
6
|
+
* The line handed in here has already been through the preprocessor, so a
|
|
7
|
+
* signature split with `_` continuations arrives as ONE logical line and a
|
|
8
|
+
* trailing `'` comment is already gone. This module must never re-implement
|
|
9
|
+
* continuation joining — see `vba-preprocess.ts` and issue #202.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.splitParameterList = splitParameterList;
|
|
13
|
+
exports.parseSignature = parseSignature;
|
|
14
|
+
/**
|
|
15
|
+
* `[Optional] [ByVal|ByRef|ParamArray] name[()] [As Type] [= default]`.
|
|
16
|
+
*
|
|
17
|
+
* The mode alternatives all demand trailing whitespace, so a parameter simply
|
|
18
|
+
* named `x` cannot be mistaken for a mode keyword. The type allows dots so
|
|
19
|
+
* `As DAO.Recordset` survives, and the bracketed `As [Type With Spaces]` form
|
|
20
|
+
* is unwrapped.
|
|
21
|
+
*/
|
|
22
|
+
const PARAM_RE = /^\s*(Optional\s+)?(ByVal\s+|ByRef\s+|ParamArray\s+)?(?:\[([^\]]+)\]|(\p{L}[\p{L}\p{N}_]*))\s*(\(\s*\))?\s*(?:As\s+(?:\[([^\]]+)\]|(\p{L}[\p{L}\p{N}_.]*)))?\s*(=[\s\S]*)?$/iu;
|
|
23
|
+
/**
|
|
24
|
+
* Find the parameter-list body that starts at the first `(` at or after
|
|
25
|
+
* `searchFrom`, returning the text between the parentheses.
|
|
26
|
+
*
|
|
27
|
+
* The scan is depth- and string-aware so a default value such as
|
|
28
|
+
* `= "a)b"` or a nested `Array(1, 2)` cannot end the list early. Returns
|
|
29
|
+
* `null` when the declaration has no parameter list at all (`Public Sub Bare`)
|
|
30
|
+
* or when the parentheses never close.
|
|
31
|
+
*
|
|
32
|
+
* Anchoring on `searchFrom` (the end of the procedure NAME) rather than on
|
|
33
|
+
* `lastIndexOf(')')` is what keeps a colon-separated single-line procedure
|
|
34
|
+
* (`Public Sub X(): Debug.Print "(y)": End Sub`) from swallowing its own body
|
|
35
|
+
* as a parameter list.
|
|
36
|
+
*/
|
|
37
|
+
function findParameterListBody(line, searchFrom) {
|
|
38
|
+
let open = -1;
|
|
39
|
+
for (let i = searchFrom; i < line.length; i++) {
|
|
40
|
+
const ch = line[i];
|
|
41
|
+
if (ch === ' ' || ch === '\t')
|
|
42
|
+
continue;
|
|
43
|
+
if (ch === '(')
|
|
44
|
+
open = i;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
if (open < 0)
|
|
48
|
+
return null;
|
|
49
|
+
let depth = 0;
|
|
50
|
+
let inString = false;
|
|
51
|
+
for (let i = open; i < line.length; i++) {
|
|
52
|
+
const ch = line[i];
|
|
53
|
+
if (inString) {
|
|
54
|
+
if (ch === '"')
|
|
55
|
+
inString = false;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (ch === '"')
|
|
59
|
+
inString = true;
|
|
60
|
+
else if (ch === '(')
|
|
61
|
+
depth++;
|
|
62
|
+
else if (ch === ')') {
|
|
63
|
+
depth--;
|
|
64
|
+
if (depth === 0)
|
|
65
|
+
return line.slice(open + 1, i);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Split a parameter-list body on its top-level commas. Depth- and
|
|
72
|
+
* string-aware, so `Optional s As String = "a,b"` stays one entry.
|
|
73
|
+
*/
|
|
74
|
+
function splitParameterList(body) {
|
|
75
|
+
if (!body.trim())
|
|
76
|
+
return [];
|
|
77
|
+
const out = [];
|
|
78
|
+
let depth = 0;
|
|
79
|
+
let inString = false;
|
|
80
|
+
let start = 0;
|
|
81
|
+
for (let i = 0; i < body.length; i++) {
|
|
82
|
+
const ch = body[i];
|
|
83
|
+
if (inString) {
|
|
84
|
+
if (ch === '"')
|
|
85
|
+
inString = false;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (ch === '"')
|
|
89
|
+
inString = true;
|
|
90
|
+
else if (ch === '(')
|
|
91
|
+
depth++;
|
|
92
|
+
else if (ch === ')')
|
|
93
|
+
depth--;
|
|
94
|
+
else if (ch === ',' && depth === 0) {
|
|
95
|
+
out.push(body.slice(start, i));
|
|
96
|
+
start = i + 1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
out.push(body.slice(start));
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Parse one raw parameter fragment. A fragment the regex cannot make sense of
|
|
104
|
+
* still yields an entry — dropping it would silently under-count the arity,
|
|
105
|
+
* and a wrong arity is worse than a coarse one.
|
|
106
|
+
*/
|
|
107
|
+
function parseParameter(raw) {
|
|
108
|
+
const m = PARAM_RE.exec(raw);
|
|
109
|
+
if (!m) {
|
|
110
|
+
return {
|
|
111
|
+
name: raw.trim(),
|
|
112
|
+
type: null,
|
|
113
|
+
byRef: true,
|
|
114
|
+
optional: false,
|
|
115
|
+
isArray: false,
|
|
116
|
+
hasDefault: false,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const mode = (m[2] ?? '').trim().toLowerCase();
|
|
120
|
+
return {
|
|
121
|
+
name: m[3] ?? m[4] ?? '',
|
|
122
|
+
type: m[6] ?? m[7] ?? null,
|
|
123
|
+
byRef: mode !== 'byval',
|
|
124
|
+
optional: Boolean(m[1]),
|
|
125
|
+
isArray: Boolean(m[5]),
|
|
126
|
+
hasDefault: Boolean(m[8]),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** `true` when the fragment declares a `ParamArray`. */
|
|
130
|
+
function isParamArray(raw) {
|
|
131
|
+
return /^\s*ParamArray\s+/i.test(raw);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Parse the signature of the procedure whose name ends at `nameEndIndex`.
|
|
135
|
+
*
|
|
136
|
+
* A `ParamArray` tail is excluded from `arity.required` (it accepts zero
|
|
137
|
+
* arguments) and forces `arity.total` to `null` (it accepts any number). The
|
|
138
|
+
* `ParamArray` parameter itself is still reported in `params` with
|
|
139
|
+
* `optional: false`, because that flag mirrors the literal `Optional` keyword
|
|
140
|
+
* — which VBA forbids on a `ParamArray`.
|
|
141
|
+
*/
|
|
142
|
+
function parseSignature(line, nameEndIndex) {
|
|
143
|
+
const body = findParameterListBody(line, nameEndIndex);
|
|
144
|
+
if (body === null) {
|
|
145
|
+
return { params: [], arity: { required: 0, total: 0 } };
|
|
146
|
+
}
|
|
147
|
+
const fragments = splitParameterList(body);
|
|
148
|
+
const params = [];
|
|
149
|
+
let unbounded = false;
|
|
150
|
+
let required = 0;
|
|
151
|
+
for (const raw of fragments) {
|
|
152
|
+
const param = parseParameter(raw);
|
|
153
|
+
params.push(param);
|
|
154
|
+
if (isParamArray(raw))
|
|
155
|
+
unbounded = true;
|
|
156
|
+
else if (!param.optional)
|
|
157
|
+
required++;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
params,
|
|
161
|
+
arity: { required, total: unbounded ? null : params.length },
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["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C,CAAC;IAC3C,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,YAAY,CAAC,GAAG,CAAC;YAAE,SAAS,GAAG,IAAI,CAAC;aACnC,IAAI,CAAC,KAAK,CAAC,QAAQ;YAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IACD,OAAO;QACL,MAAM;QACN,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,68 @@
|
|
|
1
|
-
import { VbaExtractorContext } from './context';
|
|
2
|
-
export declare function scanSqlInLine(ctx: VbaExtractorContext, line: string, lineNum: number, dedupe: Set<string>, sqlVariables: Map<string, string>): void;
|
|
1
|
+
import { VbaExtractorContext, ProcInfo } from './context';
|
|
3
2
|
/**
|
|
4
|
-
* #
|
|
3
|
+
* Issue #252 — `metadata.synthesizedBy` for a table reached through SQL
|
|
4
|
+
* assigned to a binding property at RUNTIME. Deliberately distinct from the
|
|
5
|
+
* `.form.txt` sweep's static `vba-row-source` so an audit can tell the two
|
|
6
|
+
* provenances apart: one is what the designer stored, the other is what the
|
|
7
|
+
* code actually binds.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RUNTIME_BINDING_SYNTHESIZER = "vba-row-source-dynamic";
|
|
10
|
+
/**
|
|
11
|
+
* Issue #244 — the wrapper list used when `codegraph.json` →
|
|
12
|
+
* `vba.sqlWrappers` is absent. A STRICT SUPERSET of the pre-#244 behaviour:
|
|
13
|
+
*
|
|
14
|
+
* - `db` covers every receiver the old `…db\b` regex reached (see
|
|
15
|
+
* {@link receiverMatches} for the suffix arm that preserves it) plus the
|
|
16
|
+
* `db`-prefixed locals it missed (`dbUse`, `dbToUse`, `m_dbLanzadera`).
|
|
17
|
+
* - `getdb` covers the per-backend accessor family (`getdbHPS()`,
|
|
18
|
+
* `getdbExpedientes()`, `getdbLanzadera()`) the issue measured at 26-36%
|
|
19
|
+
* of all execution sites.
|
|
20
|
+
* - `CurrentDb` / `DBEngine` are the Access built-ins.
|
|
21
|
+
* - `qd` / `qdf` are the conventional DAO `QueryDef` receivers.
|
|
22
|
+
* - `DoCmd.RunSQL` is the Access statement form (both the literal and the
|
|
23
|
+
* variable spelling, previously two dedicated regexes).
|
|
24
|
+
* - `Connection.Execute` / `Recordset.Open` are the ADO pair.
|
|
25
|
+
*
|
|
26
|
+
* Project-specific accessors that do not fit these names are added through
|
|
27
|
+
* `vba.sqlWrappers`, which EXTENDS this list rather than replacing it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_SQL_WRAPPERS: readonly string[];
|
|
30
|
+
/** One parsed wrapper entry. Both fields are lowercase — VBA is case-insensitive. */
|
|
31
|
+
interface SqlWrapperMatcher {
|
|
32
|
+
/** Receiver name fragment, e.g. `getdb` from `"getdb"` or `cnn` from `"cnn.Execute"`. */
|
|
33
|
+
receiver: string;
|
|
34
|
+
/** Method name, or `null` for a bare entry (which implies {@link DEFAULT_WRAPPER_METHODS}). */
|
|
35
|
+
method: string | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The per-extractor compiled wrapper state. Built ONCE per `VbaExtractor`
|
|
39
|
+
* (see `vba-extractor.ts`) and cached on `VbaExtractorContext` — the two
|
|
40
|
+
* RegExps are stateful (`/g`) and `scanSqlInLine` runs on every line of every
|
|
41
|
+
* file, so re-compiling them per line (which is what the pre-#244 code did)
|
|
42
|
+
* is pure waste on the hottest path in VBA extraction.
|
|
43
|
+
*/
|
|
44
|
+
export interface CompiledSqlWrappers {
|
|
45
|
+
/** Literal form — `<receiver>[()].<method> "…"`. Stateful; reset before use. */
|
|
46
|
+
readonly literalRe: RegExp;
|
|
47
|
+
/** Variable form — `<receiver>[()].<method> <identifier>`. Stateful; reset before use. */
|
|
48
|
+
readonly varRe: RegExp;
|
|
49
|
+
/** Parsed entries, defaults first, project entries appended. */
|
|
50
|
+
readonly matchers: readonly SqlWrapperMatcher[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse the plain-string wrapper entries into matchers and pair them with a
|
|
54
|
+
* fresh pair of scanning RegExps.
|
|
55
|
+
*
|
|
56
|
+
* `configured` entries are APPENDED to {@link DEFAULT_SQL_WRAPPERS}, never
|
|
57
|
+
* substituted for them: a project that names its own accessor must not lose
|
|
58
|
+
* `CurrentDb` in the trade. Entries are accepted in exactly two forms — a
|
|
59
|
+
* bare identifier fragment (`"getdb"`) or a `receiver.method` pair
|
|
60
|
+
* (`"cnn.Execute"`). Anything else is dropped here; `project-config.ts`
|
|
61
|
+
* already warned about it at load time.
|
|
62
|
+
*/
|
|
63
|
+
export declare function compileSqlWrappers(configured?: readonly string[]): CompiledSqlWrappers;
|
|
64
|
+
/**
|
|
65
|
+
* Issue #13: `sql = sql & "..."` (self-referential concatenation) must
|
|
5
66
|
* ACCUMULATE the new fragment onto whatever was already tracked for
|
|
6
67
|
* `varName`, not overwrite it. Overwriting silently dropped earlier
|
|
7
68
|
* fragments' tables — typically the initial `FROM <table>` in
|
|
@@ -14,4 +75,16 @@ export declare function scanSqlInLine(ctx: VbaExtractorContext, line: string, li
|
|
|
14
75
|
* behavior is unchanged.
|
|
15
76
|
*/
|
|
16
77
|
export declare function trackSqlVariableAssignment(lines: string[], lineIndex: number, sqlVariables: Map<string, string>): void;
|
|
78
|
+
/**
|
|
79
|
+
* Issue #255: scan one line for domain-aggregate calls and emit the saved-query
|
|
80
|
+
* reference their second argument names.
|
|
81
|
+
*
|
|
82
|
+
* Deliberately NOT handled: a domain spelled as a full SQL statement
|
|
83
|
+
* (`DLookup("N", "SELECT Id FROM T")`), which Access also accepts. It is
|
|
84
|
+
* rejected by `looksLikeSavedQueryName`'s verb gate and produces nothing —
|
|
85
|
+
* the same silence T11 chose for every literal it cannot classify.
|
|
86
|
+
*/
|
|
87
|
+
export declare function scanDomainFunctionsInLine(ctx: VbaExtractorContext, line: string, lineNum: number, dedupe: Set<string>, caller: ProcInfo): void;
|
|
88
|
+
export declare function scanSqlInLine(ctx: VbaExtractorContext, line: string, lineNum: number, dedupe: Set<string>, sqlVariables: Map<string, string>, caller?: ProcInfo): void;
|
|
89
|
+
export {};
|
|
17
90
|
//# sourceMappingURL=sql-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-wrapper.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/sql-wrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sql-wrapper.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/sql-wrapper.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAa1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AA6FpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAUjD,CAAC;AAEF,qFAAqF;AACrF,UAAU,iBAAiB;IACzB,yFAAyF;IACzF,QAAQ,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,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