(
lines: string[],
rootRawExpr: string,
path: string[],
indent: string,
varPrefix: string
)
| 1566 | } |
| 1567 | |
| 1568 | function pushGoJSONRequiredRawPathLines( |
| 1569 | lines: string[], |
| 1570 | rootRawExpr: string, |
| 1571 | path: string[], |
| 1572 | indent: string, |
| 1573 | varPrefix: string |
| 1574 | ): string { |
| 1575 | let rawExpr = rootRawExpr; |
| 1576 | for (let index = 0; index < path.length; index++) { |
| 1577 | const structVar = goJSONPathVarName(varPrefix, path.slice(0, index)); |
| 1578 | const fieldNames = pushGoJSONRawStructUnmarshalLines(lines, rawExpr, structVar, [path[index]], indent); |
| 1579 | const fieldExpr = `${structVar}.${fieldNames.get(path[index])!}`; |
| 1580 | lines.push(`${indent}if ${fieldExpr} == nil {`); |
| 1581 | lines.push(`${indent}\treturn false`); |
| 1582 | lines.push(`${indent}}`); |
| 1583 | rawExpr = fieldExpr; |
| 1584 | } |
| 1585 | return rawExpr; |
| 1586 | } |
| 1587 | |
| 1588 | function pushGoJSONOptionalRawPathLines( |
| 1589 | lines: string[], |
no test coverage detected
searching dependent graphs…