ucn 3.7.22 → 3.7.23
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/languages/utils.js +31 -1
- package/package.json +1 -1
package/languages/utils.js
CHANGED
|
@@ -81,6 +81,13 @@ function parseStructuredParams(paramsNode, language) {
|
|
|
81
81
|
|
|
82
82
|
if (paramInfo.name) {
|
|
83
83
|
params.push(paramInfo);
|
|
84
|
+
// Go multi-name declarations: `a, b int` → expand additional params
|
|
85
|
+
if (paramInfo._additionalNames) {
|
|
86
|
+
for (const extraName of paramInfo._additionalNames) {
|
|
87
|
+
params.push({ name: extraName, type: paramInfo.type });
|
|
88
|
+
}
|
|
89
|
+
delete paramInfo._additionalNames;
|
|
90
|
+
}
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
|
|
@@ -106,6 +113,9 @@ function parseJSParam(param, info) {
|
|
|
106
113
|
const rightNode = param.childForFieldName('right');
|
|
107
114
|
if (leftNode) info.name = leftNode.text;
|
|
108
115
|
if (rightNode) info.default = rightNode.text;
|
|
116
|
+
} else if (param.type === 'object_pattern' || param.type === 'array_pattern') {
|
|
117
|
+
// Destructured params: { name, value } or [a, b]
|
|
118
|
+
info.name = param.text;
|
|
109
119
|
}
|
|
110
120
|
}
|
|
111
121
|
|
|
@@ -131,10 +141,30 @@ function parsePythonParam(param, info) {
|
|
|
131
141
|
|
|
132
142
|
function parseGoParam(param, info) {
|
|
133
143
|
if (param.type === 'parameter_declaration') {
|
|
144
|
+
const typeNode = param.childForFieldName('type');
|
|
145
|
+
// Go allows multiple names per declaration: `a, b int`
|
|
146
|
+
// Collect all identifier children (names come before the type)
|
|
147
|
+
const names = [];
|
|
148
|
+
for (let i = 0; i < param.namedChildCount; i++) {
|
|
149
|
+
const child = param.namedChild(i);
|
|
150
|
+
if (child && child.type === 'identifier') {
|
|
151
|
+
names.push(child.text);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (names.length > 0) info.name = names[0];
|
|
155
|
+
if (typeNode) info.type = typeNode.text;
|
|
156
|
+
// Store additional names for multi-param declarations (handled by parseStructuredParams)
|
|
157
|
+
if (names.length > 1) {
|
|
158
|
+
info._additionalNames = names.slice(1);
|
|
159
|
+
}
|
|
160
|
+
} else if (param.type === 'variadic_parameter_declaration') {
|
|
161
|
+
// Go variadic: `args ...int`
|
|
134
162
|
const nameNode = param.childForFieldName('name');
|
|
135
163
|
const typeNode = param.childForFieldName('type');
|
|
136
164
|
if (nameNode) info.name = nameNode.text;
|
|
137
|
-
|
|
165
|
+
else info.name = '...';
|
|
166
|
+
if (typeNode) info.type = '...' + typeNode.text;
|
|
167
|
+
info.rest = true;
|
|
138
168
|
}
|
|
139
169
|
}
|
|
140
170
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ucn",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.23",
|
|
4
4
|
"mcpName": "io.github.mleoca/ucn",
|
|
5
5
|
"description": "Universal Code Navigator — AST-based call graph analysis for AI agents. Find callers, trace impact, detect dead code across JS/TS, Python, Go, Rust, Java, and HTML. CLI, MCP server, and agent skill.",
|
|
6
6
|
"main": "index.js",
|