feat(verify): add --call and --buf flags for single-function invocation

Assisted-by: GLM 5.2
This commit is contained in:
2026-08-05 20:46:39 +02:00
parent ece0d3f127
commit b0c62be8ce
6 changed files with 518 additions and 17 deletions
+25 -8
View File
@@ -79,22 +79,39 @@ func parseParams(s string) []param {
if s == "" {
return nil
}
fields := strings.Split(s, ",")
// First pass: extract the type from each field (if present).
types := make([]string, len(fields))
for i, field := range fields {
parts := strings.Fields(strings.TrimSpace(field))
if len(parts) >= 2 {
types[i] = parts[len(parts)-1]
}
}
// Propagate types backward: a field without a type inherits from the next
// field that has one (e.g. "dst" inherits "[]byte" from "src []byte").
for i := range fields {
if types[i] == "" {
for j := i + 1; j < len(fields); j++ {
if types[j] != "" {
types[i] = types[j]
break
}
}
}
}
var out []param
for _, field := range strings.Split(s, ",") {
for i, field := range fields {
field = strings.TrimSpace(field)
if field == "" {
continue
}
parts := strings.Fields(field)
if len(parts) == 1 {
// Unnamed: "int" or "[]byte".
typ := types[i]
if typ == "" {
out = append(out, param{typ: parts[0]})
} else {
// Named: "a []byte" or shared "a, b []int32" (handled by the
// comma split above — "a" alone means the type follows in the
// next field; this is a simplification that covers the common
// case where each param has its own type).
out = append(out, param{name: parts[0], typ: parts[1]})
out = append(out, param{name: parts[0], typ: typ})
}
}
return out