1
1
mirror of https://github.com/wader/fq.git synced 2024-09-11 20:07:11 +03:00

Merge pull request #801 from wader/interp-synthetic-raw-inf-recur

interp: Fix infinite recursion when casting synthetic raw value into …
This commit is contained in:
Mattias Wadman 2023-10-29 16:23:41 +01:00 committed by GitHub
commit 7c8fa05e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -89,6 +89,8 @@ func ToGoJQValueFn(v any, valueFn func(v any) (any, error)) (any, error) {
vvs[k] = v
}
return vvs, nil
case error:
return nil, vv
default:
nv, err := valueFn(vv)
if err != nil {

View File

@ -634,12 +634,15 @@ func (v decodeValue) JQValueToGoJQEx(optsFn func() (*Options, error)) any {
return v.JQValueToGoJQ()
}
bv, err := v.decodeValueBase.ToBinary()
if err != nil {
return err
if s, ok := v.dv.V.(scalar.Scalarable); ok && !s.ScalarFlags().IsSynthetic() {
bv, err := v.ToBinary()
if err != nil {
return err
}
return bv.JQValueToGoJQEx(optsFn)
}
return bv.JQValueToGoJQEx(optsFn)
return v.JQValueToGoJQ()
}