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

Method findTrailingComments

src/comment-handler.ts:55–78  ·  view source on GitHub ↗
(metadata)

Source from the content-addressed store, hash-verified

53 }
54
55 findTrailingComments(metadata) {
56 let trailingComments: Comment[] = [];
57
58 if (this.trailing.length > 0) {
59 for (let i = this.trailing.length - 1; i >= 0; --i) {
60 const entry = this.trailing[i];
61 if (entry.start >= metadata.end.offset) {
62 trailingComments.unshift(entry.comment);
63 }
64 }
65 this.trailing.length = 0;
66 return trailingComments;
67 }
68
69 const entry = this.stack[this.stack.length - 1];
70 if (entry && entry.node.trailingComments) {
71 const firstComment = entry.node.trailingComments[0];
72 if (firstComment && firstComment.range[0] >= metadata.end.offset) {
73 trailingComments = entry.node.trailingComments;
74 delete entry.node.trailingComments;
75 }
76 }
77 return trailingComments;
78 }
79
80 findLeadingComments(metadata) {
81 const leadingComments: Comment[] = [];

Callers 1

visitNodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected