(comment []byte)
| 116 | } |
| 117 | |
| 118 | func (p *parser) emitComment(comment []byte) { |
| 119 | isFirstNonemptyLine := false |
| 120 | for len(comment) > 0 { |
| 121 | n := bytes.IndexByte(comment, '\n') |
| 122 | if n < 0 { |
| 123 | n = len(comment) |
| 124 | } |
| 125 | line := stripTrailingSpace(comment[:n]) |
| 126 | if bytes.HasPrefix(line, []byte("//")) { |
| 127 | line = line[2:] |
| 128 | if len(line) > 0 && isSpace(line[0]) { |
| 129 | line = line[1:] |
| 130 | } |
| 131 | } |
| 132 | if len(line) == 0 { |
| 133 | if isFirstNonemptyLine { |
| 134 | fmt.Fprintf(p.w, "//\n") |
| 135 | } |
| 136 | } else { |
| 137 | fmt.Fprintf(p.w, "// %s\n", line) |
| 138 | isFirstNonemptyLine = true |
| 139 | } |
| 140 | |
| 141 | if n < len(comment) { |
| 142 | comment = comment[n+1:] |
| 143 | } else { |
| 144 | comment = comment[n:] |
| 145 | } |
| 146 | } |
| 147 | fmt.Fprintf(p.w, "\n") |
| 148 | } |
| 149 | |
| 150 | func (p *parser) emitImportsUse() { |
| 151 | if p.importsUseEmitted { |
no test coverage detected