MCPcopy
hub / github.com/jquery/esprima / visitNode

Method visitNode

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

Source from the content-addressed store, hash-verified

117 }
118
119 visitNode(node, metadata) {
120 if (node.type === Syntax.Program && node.body.length > 0) {
121 return;
122 }
123
124 this.insertInnerComments(node, metadata);
125 const trailingComments = this.findTrailingComments(metadata);
126 const leadingComments = this.findLeadingComments(metadata);
127 if (leadingComments.length > 0) {
128 node.leadingComments = leadingComments;
129 }
130 if (trailingComments.length > 0) {
131 node.trailingComments = trailingComments;
132 }
133
134 this.stack.push({
135 node: node,
136 start: metadata.start.offset
137 });
138 }
139
140 visitComment(node, metadata) {
141 const type = (node.type[0] === 'L') ? 'Line' : 'Block';

Callers 1

visitMethod · 0.95

Calls 4

insertInnerCommentsMethod · 0.95
findTrailingCommentsMethod · 0.95
findLeadingCommentsMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected