MCPcopy Index your code
hub / github.com/jquery/esprima / visitComment

Method visitComment

src/comment-handler.ts:140–170  ·  view source on GitHub ↗
(node, metadata)

Source from the content-addressed store, hash-verified

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') {

Callers 1

visitMethod · 0.95

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected