Skip to content

Commit

Permalink
Merge pull request #40 from tineheller/master
Browse files Browse the repository at this point in the history
Fixes for callbacks and inner module members
  • Loading branch information
wehrstedt authored Aug 15, 2018
2 parents 4099044 + 790e856 commit f6836e6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
22 changes: 22 additions & 0 deletions exampleProject/src/core/myModule2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @module myModule2
*/
/**
* exported function
* @function myFunction1
* @param {string} myString
* @param {testCallback} myCallback
* @static
*/
/**
* exported callback
* @callback testCallback
* @param {string} testCBParam
* @static
*/

/**
* inner function
* @function myFunction2
* @param {string} myString
*/
21 changes: 21 additions & 0 deletions exampleProject/src/core/myModule3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @module myModule3
*/
module.exports = {
/**
* exported function
* @param {string} param1
* @return {string}
*/
myFunction1: function(param1, color2) {
// ...
},
/**
* inner function
* @param {string} param2
* @inner
*/
myFunction2: function(param2) {
// ...
},
};
9 changes: 5 additions & 4 deletions src/core/jsdoc-tsd-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class JSDocTsdParser {

case "const":
let constDeclaration = dom.create.const((namespaceMember as dom.ConstDeclaration).name, (namespaceMember as dom.ConstDeclaration).type);
if (!parsedItem.flags || 0 === (parsedItem.flags & dom.DeclarationFlags.Private)) {
if (parsedItem.flags && ((parsedItem.flags & dom.DeclarationFlags.Export) || (parsedItem.flags & dom.DeclarationFlags.Static))) {
constDeclaration.flags = dom.DeclarationFlags.Export;
}
constDeclaration.comment = namespaceMember.comment;
Expand All @@ -221,7 +221,7 @@ export class JSDocTsdParser {

case "property":
let variableDeclaration = dom.create.variable((namespaceMember as dom.VariableDeclaration).name, (namespaceMember as dom.VariableDeclaration).type);
if (!parsedItem.flags || 0 === (parsedItem.flags & dom.DeclarationFlags.Private)) {
if (parsedItem.flags && ((parsedItem.flags & dom.DeclarationFlags.Export) || (parsedItem.flags & dom.DeclarationFlags.Static))) {
variableDeclaration.flags = dom.DeclarationFlags.Export;
}
variableDeclaration.comment = namespaceMember.comment;
Expand Down Expand Up @@ -320,7 +320,7 @@ export class JSDocTsdParser {

case "property":
let variableDeclaration = dom.create.variable((moduleMember as dom.VariableDeclaration).name, (moduleMember as dom.VariableDeclaration).type);
if (!parsedItem.flags || 0 === (parsedItem.flags & dom.DeclarationFlags.Private)) {
if (parsedItem.flags && ((parsedItem.flags & dom.DeclarationFlags.Export) || (parsedItem.flags & dom.DeclarationFlags.Static))) {
variableDeclaration.flags = dom.DeclarationFlags.Export;
}
variableDeclaration.comment = moduleMember.comment;
Expand All @@ -329,7 +329,8 @@ export class JSDocTsdParser {
break;

case "function":
if (!parsedItem.flags || 0 === (parsedItem.flags & dom.DeclarationFlags.Private)) {
case "alias":
if (parsedItem.flags && ((parsedItem.flags & dom.DeclarationFlags.Export) || (parsedItem.flags & dom.DeclarationFlags.Static))) {
moduleMember.flags = dom.DeclarationFlags.Export;
}
(parentItem as dom.ModuleDeclaration).members.push(moduleMember);
Expand Down

0 comments on commit f6836e6

Please sign in to comment.