( group: GroupType, fields: ProcessedField[], groupCoderLocation: 'get' | 'set' )
| 76 | } |
| 77 | |
| 78 | export const applyGroupAccessCoder = ( |
| 79 | group: GroupType, |
| 80 | fields: ProcessedField[], |
| 81 | groupCoderLocation: 'get' | 'set' |
| 82 | ) => { |
| 83 | const groupCoderType = groupCoderLocation === 'get' |
| 84 | ? group.accessors?.getterCoderType |
| 85 | : group.accessors?.setterCoderType; |
| 86 | |
| 87 | for (let i = 0; i < fields.length; i++) { |
| 88 | const field = fields[i] |
| 89 | const member = group.members[i] |
| 90 | // If group member defines coder type, it will override the group's coder type |
| 91 | // and the coder type of the original field in the struct. |
| 92 | // If group defines coder type, it will override the coder type of the original |
| 93 | // field in the struct. |
| 94 | if (member.coderType) applyCoderType(field, member.coderType); |
| 95 | else if (groupCoderType) applyCoderType(field, groupCoderType); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | export const applyCoderType = (field: ProcessedField, coderType: CoderType) => { |
| 100 | field.coderType = coderType; |
no test coverage detected