2017-07-11 15:57:26 +00:00
|
|
|
class Documentation {
|
|
|
|
/**
|
|
|
|
* @param {!Array<!Documentation.Class>} clasesArray
|
|
|
|
*/
|
|
|
|
constructor(classesArray) {
|
|
|
|
this.classesArray = classesArray;
|
|
|
|
this.classes = new Map();
|
|
|
|
for (let cls of classesArray)
|
|
|
|
this.classes.set(cls.name, cls);
|
|
|
|
}
|
|
|
|
}
|
2017-07-07 16:36:45 +00:00
|
|
|
|
|
|
|
Documentation.Class = class {
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
2017-07-14 05:52:02 +00:00
|
|
|
* @param {!Array<!Documentation.Member>} membersArray
|
2017-07-07 16:36:45 +00:00
|
|
|
*/
|
2017-07-14 05:52:02 +00:00
|
|
|
constructor(name, membersArray) {
|
2017-07-07 16:36:45 +00:00
|
|
|
this.name = name;
|
2017-07-14 05:52:02 +00:00
|
|
|
this.membersArray = membersArray;
|
|
|
|
this.members = new Map();
|
|
|
|
this.properties = new Map();
|
2017-07-07 16:36:45 +00:00
|
|
|
this.methods = new Map();
|
2017-07-14 20:03:21 +00:00
|
|
|
this.events = new Map();
|
2017-07-14 05:52:02 +00:00
|
|
|
for (let member of membersArray) {
|
|
|
|
this.members.set(member.name, member);
|
|
|
|
if (member.type === 'method')
|
|
|
|
this.methods.set(member.name, member);
|
|
|
|
else if (member.type === 'property')
|
|
|
|
this.properties.set(member.name, member);
|
2017-07-14 20:03:21 +00:00
|
|
|
else if (member.type === 'event')
|
|
|
|
this.events.set(member.name, member);
|
2017-07-14 05:52:02 +00:00
|
|
|
}
|
2017-07-07 16:36:45 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-14 05:52:02 +00:00
|
|
|
Documentation.Member = class {
|
2017-07-11 15:57:26 +00:00
|
|
|
/**
|
2017-07-14 05:52:02 +00:00
|
|
|
* @param {string} type
|
2017-07-11 15:57:26 +00:00
|
|
|
* @param {string} name
|
2017-07-13 22:15:31 +00:00
|
|
|
* @param {!Array<!Documentation.Argument>} argsArray
|
2017-07-13 22:54:37 +00:00
|
|
|
* @param {boolean} hasReturn
|
|
|
|
* @param {boolean} async
|
2017-07-11 15:57:26 +00:00
|
|
|
*/
|
2017-07-13 22:54:37 +00:00
|
|
|
constructor(type, name, argsArray, hasReturn, async) {
|
2017-07-14 05:52:02 +00:00
|
|
|
this.type = type;
|
2017-07-11 15:57:26 +00:00
|
|
|
this.name = name;
|
2017-07-13 22:15:31 +00:00
|
|
|
this.argsArray = argsArray;
|
|
|
|
this.args = new Map();
|
2017-07-13 22:54:37 +00:00
|
|
|
this.hasReturn = hasReturn;
|
|
|
|
this.async = async;
|
2017-07-13 22:15:31 +00:00
|
|
|
for (let arg of argsArray)
|
|
|
|
this.args.set(arg.name, arg);
|
2017-07-11 15:57:26 +00:00
|
|
|
}
|
2017-07-14 05:52:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @param {!Array<!Documentation.Argument>} argsArray
|
2017-07-13 22:54:37 +00:00
|
|
|
* @param {boolean} hasReturn
|
2017-07-14 05:52:02 +00:00
|
|
|
* @return {!Documentation.Member}
|
|
|
|
*/
|
2017-07-13 22:54:37 +00:00
|
|
|
static createMethod(name, argsArray, hasReturn, async) {
|
|
|
|
return new Documentation.Member('method', name, argsArray, hasReturn, async);
|
2017-07-14 05:52:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @return {!Documentation.Member}
|
|
|
|
*/
|
|
|
|
static createProperty(name) {
|
2017-07-13 22:54:37 +00:00
|
|
|
return new Documentation.Member('property', name, [], false, false);
|
2017-07-14 05:52:02 +00:00
|
|
|
}
|
2017-07-14 20:03:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @return {!Documentation.Member}
|
|
|
|
*/
|
|
|
|
static createEvent(name) {
|
|
|
|
return new Documentation.Member('event', name, [], false, false);
|
|
|
|
}
|
2017-07-11 15:57:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Documentation.Argument = class {
|
2017-07-07 16:36:45 +00:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
*/
|
|
|
|
constructor(name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Documentation;
|
2017-07-11 15:57:26 +00:00
|
|
|
|