( resultType reflect.Type, stack map[reflect.Type]bool, )
| 1266 | } |
| 1267 | |
| 1268 | func cachedFieldsForTypeWithStack( |
| 1269 | resultType reflect.Type, |
| 1270 | stack map[reflect.Type]bool, |
| 1271 | ) *fieldsType { |
| 1272 | if fields, ok := fieldsMap.Load(resultType); ok { |
| 1273 | return fields.(*fieldsType) |
| 1274 | } |
| 1275 | |
| 1276 | if stack != nil && stack[resultType] { |
| 1277 | return nil |
| 1278 | } |
| 1279 | |
| 1280 | nextStack := make(map[reflect.Type]bool, len(stack)+1) |
| 1281 | for typ := range stack { |
| 1282 | nextStack[typ] = true |
| 1283 | } |
| 1284 | nextStack[resultType] = true |
| 1285 | |
| 1286 | fields := makeStructFieldsWithStack(resultType, nextStack) |
| 1287 | actual, _ := fieldsMap.LoadOrStore(resultType, fields) |
| 1288 | |
| 1289 | return actual.(*fieldsType) |
| 1290 | } |
| 1291 | |
| 1292 | // makeStructFields implements json/v2 style field precedence rules. |
| 1293 | func makeStructFields(rootType reflect.Type) *fieldsType { |
no test coverage detected
searching dependent graphs…