(depthDelta int)
| 1035 | } |
| 1036 | |
| 1037 | func (p *printer) writeIndent(depthDelta int) { |
| 1038 | if len(p.prefix) == 0 && len(p.indent) == 0 { |
| 1039 | return |
| 1040 | } |
| 1041 | if depthDelta < 0 { |
| 1042 | p.depth-- |
| 1043 | if p.indentedIn { |
| 1044 | p.indentedIn = false |
| 1045 | return |
| 1046 | } |
| 1047 | p.indentedIn = false |
| 1048 | } |
| 1049 | if p.putNewline { |
| 1050 | p.WriteByte('\n') |
| 1051 | } else { |
| 1052 | p.putNewline = true |
| 1053 | } |
| 1054 | if len(p.prefix) > 0 { |
| 1055 | p.WriteString(p.prefix) |
| 1056 | } |
| 1057 | if len(p.indent) > 0 { |
| 1058 | for i := 0; i < p.depth; i++ { |
| 1059 | p.WriteString(p.indent) |
| 1060 | } |
| 1061 | } |
| 1062 | if depthDelta > 0 { |
| 1063 | p.depth++ |
| 1064 | p.indentedIn = true |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | type parentStack struct { |
| 1069 | p *printer |
no test coverage detected