mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
[wip] Test support for namepaths containing special characters
This commit is contained in:
parent
c33fe6b904
commit
a4889c97ec
@ -27,9 +27,14 @@ module.exports = function () {
|
||||
}
|
||||
|
||||
function inferName(path, node) {
|
||||
if (node && node.name) {
|
||||
comment.name = node.name;
|
||||
return true;
|
||||
if (node) {
|
||||
if (node.name) {
|
||||
comment.name = node.name;
|
||||
return true;
|
||||
} else if (node.type === 'StringLiteral') {
|
||||
comment.name = node.value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +50,7 @@ module.exports = function () {
|
||||
// infer the named based on the `property` of the MemberExpression (`bar`)
|
||||
// rather than the `object` (`foo`).
|
||||
comment.context.ast.traverse({
|
||||
|
||||
/**
|
||||
* Attempt to extract the name from an Identifier node.
|
||||
* If the name can be resolved, it will stop traversing.
|
||||
@ -57,6 +63,7 @@ module.exports = function () {
|
||||
path.stop();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Attempt to extract the name from an Identifier node.
|
||||
* If the name can be resolved, it will stop traversing.
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"concat-stream": "^1.5.0",
|
||||
"debounce": "^1.0.0",
|
||||
"disparity": "^2.0.0",
|
||||
"doctrine": "^1.1.0",
|
||||
"doctrine": "^1.2.0",
|
||||
"events": "^1.1.0",
|
||||
"extend": "^3.0.0",
|
||||
"get-comments": "^1.0.1",
|
||||
|
||||
@ -1,23 +1,37 @@
|
||||
/**
|
||||
* This is my class, a demo thing.
|
||||
* @class MyClass
|
||||
* @property {number} howMany how many things it contains
|
||||
*/
|
||||
function MyClass() {
|
||||
this.howMany = 2;
|
||||
}
|
||||
// /**
|
||||
// * This is my class, a demo thing.
|
||||
// * @class MyClass
|
||||
// * @property {number} howMany how many things it contains
|
||||
// */
|
||||
// function MyClass() {
|
||||
// this.howMany = 2;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get the number 42
|
||||
// * @param {boolean} getIt whether to get the number
|
||||
// * @returns {number} forty-two
|
||||
// */
|
||||
// MyClass.prototype.getFoo = function (getIt) {
|
||||
// return getIt ? 42 : 0;
|
||||
// };
|
||||
//
|
||||
// /**
|
||||
// * Get undefined
|
||||
// * @returns {undefined} does not return anything.
|
||||
// */
|
||||
// MyClass.prototype.getUndefined = function () { };
|
||||
//
|
||||
// /**
|
||||
// * A colon-separated name
|
||||
// * @returns {undefined} does not return anything.
|
||||
// */
|
||||
// MyClass.prototype['colon:name'] = function () { };
|
||||
|
||||
/**
|
||||
* Get the number 42
|
||||
* @param {boolean} getIt whether to get the number
|
||||
* @returns {number} forty-two
|
||||
*/
|
||||
MyClass.prototype.getFoo = function (getIt) {
|
||||
return getIt ? 42 : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get undefined
|
||||
* A colon-separated name specified manually
|
||||
*
|
||||
* @name "colon:foo"
|
||||
* @returns {undefined} does not return anything.
|
||||
*/
|
||||
MyClass.prototype.getUndefined = function () { };
|
||||
MyClass.prototype['colon:foo'] = function () { };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user