fix: resolve parameterized $compareTo types and fix array count type
- VisitNameAndData: return any instead of named struct when mergeCompareTo resolves $compareTo, fixing field type mismatches for switch/container types - ContainerCompareTo: traverse anon/bitfield fields for compareTo resolution, fixes entityMetadata 'field not found' errors - Array.Count: change from string to any to handle numeric count values - ArrayEncoder: fix nil check to correctly write length prefix for arrays - ArrayDecoder: use fmt.Sprint for safe Count conversion
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"slices"
|
||||
@@ -124,13 +125,14 @@ func ArrayDecoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
||||
return
|
||||
}
|
||||
} else {
|
||||
countStr := fmt.Sprint(data.Count)
|
||||
var n int
|
||||
n, err = strconv.Atoi(data.Count)
|
||||
n, err = strconv.Atoi(countStr)
|
||||
var e ast.Expr
|
||||
if err == nil {
|
||||
e = NumLit(n)
|
||||
} else {
|
||||
e, _, err = g.ParseCompareTo(data.Count)
|
||||
e, _, err = g.ParseCompareTo(countStr)
|
||||
}
|
||||
s2 = append(s2, Assign121(Ident(lName), e))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user