| 138 | } |
| 139 | |
| 140 | visitComment(node, metadata) { |
| 141 | const type = (node.type[0] === 'L') ? 'Line' : 'Block'; |
| 142 | const comment: Comment = { |
| 143 | type: type, |
| 144 | value: node.value |
| 145 | }; |
| 146 | if (node.range) { |
| 147 | comment.range = node.range; |
| 148 | } |
| 149 | if (node.loc) { |
| 150 | comment.loc = node.loc; |
| 151 | } |
| 152 | this.comments.push(comment); |
| 153 | |
| 154 | if (this.attach) { |
| 155 | const entry: Entry = { |
| 156 | comment: { |
| 157 | type: type, |
| 158 | value: node.value, |
| 159 | range: [metadata.start.offset, metadata.end.offset] |
| 160 | }, |
| 161 | start: metadata.start.offset |
| 162 | }; |
| 163 | if (node.loc) { |
| 164 | entry.comment.loc = node.loc; |
| 165 | } |
| 166 | node.type = type; |
| 167 | this.leading.push(entry); |
| 168 | this.trailing.push(entry); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | visit(node, metadata) { |
| 173 | if (node.type === 'LineComment') { |