MCPcopy Index your code
hub / github.com/ternjs/tern / interpretComments

Function interpretComments

plugin/doc_comment.js:175–193  ·  view source on GitHub ↗
(node, comments, scope, aval, type)

Source from the content-addressed store, hash-verified

173 }
174
175 function interpretComments(node, comments, scope, aval, type) {
176 jsdocInterpretComments(node, scope, aval, comments);
177 var cx = infer.cx();
178
179 if (!type && aval instanceof infer.AVal && aval.types.length) {
180 type = aval.types[aval.types.length - 1];
181 if (!(type instanceof infer.Obj) || type.origin != cx.curOrigin || type.doc)
182 type = null;
183 }
184
185 for (var i = comments.length - 1; i >= 0; i--) {
186 var text = stripLeadingChars(comments[i].split(/\r\n?|\n/)).join("\n");
187 if (text) {
188 if (aval instanceof infer.AVal) aval.doc = text;
189 if (type) type.doc = text;
190 break;
191 }
192 }
193 }
194
195 // Parses a subset of JSDoc-style comments in order to include the
196 // explicitly defined types in the analysis.

Callers 1

postInferFunction · 0.85

Calls 2

jsdocInterpretCommentsFunction · 0.85
stripLeadingCharsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…