mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
Parse top-level floating comments
This commit is contained in:
parent
c1d8695471
commit
09ef9865cf
6
index.js
6
index.js
@ -146,13 +146,17 @@ module.exports = function (indexes) {
|
||||
file: data.file
|
||||
};
|
||||
|
||||
if (path.parent.node) {
|
||||
if (path.parent && path.parent.node) {
|
||||
comment.context.code = code.substring
|
||||
.apply(code, path.parent.node.range);
|
||||
}
|
||||
}
|
||||
|
||||
types.visit(ast, {
|
||||
visitProgram: makeVisitor(function (comment, node, path) {
|
||||
addContext(comment, path);
|
||||
}),
|
||||
|
||||
visitMemberExpression: makeVisitor(function (comment, node, path) {
|
||||
inferName(comment, node.property.name);
|
||||
addContext(comment, path);
|
||||
|
||||
@ -1 +1,28 @@
|
||||
[]
|
||||
[
|
||||
{
|
||||
"description": "This function returns the number one.",
|
||||
"tags": [
|
||||
{
|
||||
"title": "return",
|
||||
"description": "numberone",
|
||||
"type": {
|
||||
"type": "NameExpression",
|
||||
"name": "Number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
}
|
||||
},
|
||||
"file": "fixture/comment-only.input.js"
|
||||
}
|
||||
}
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user