MCPcopy Index your code
hub / github.com/jsdoc/jsdoc / addDocletRef

Method addDocletRef

lib/jsdoc/src/parser.js:309–335  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

307
308 // TODO: docs
309 addDocletRef(e) {
310 let fakeDoclet;
311 let node;
312
313 if (e && e.code && e.code.node) {
314 node = e.code.node;
315 if (e.doclet) {
316 // allow lookup from node ID => doclet
317 this._byNodeId.put(node.nodeId, e.doclet);
318 this._byLongname.put(e.doclet.longname, e.doclet);
319 }
320 // keep references to undocumented anonymous functions, too, as they might have scoped vars
321 else if (
322 (node.type === Syntax.FunctionDeclaration || node.type === Syntax.FunctionExpression ||
323 node.type === Syntax.ArrowFunctionExpression) &&
324 !this._getDocletById(node.nodeId) ) {
325 fakeDoclet = {
326 longname: jsdoc.name.LONGNAMES.ANONYMOUS,
327 meta: {
328 code: e.code
329 }
330 };
331 this._byNodeId.put(node.nodeId, fakeDoclet);
332 this._byLongname.put(fakeDoclet.longname, fakeDoclet);
333 }
334 }
335 }
336
337 // TODO: docs
338 _getDocletById(id) {

Callers 1

visitNodeMethod · 0.80

Calls 2

_getDocletByIdMethod · 0.95
putMethod · 0.80

Tested by

no test coverage detected