parse and display inherited events
This commit is contained in:
parent
ea08852676
commit
e348acee86
2 changed files with 58 additions and 37 deletions
|
|
@ -19,7 +19,10 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
events <[o]|u> Events (array of doc objects)
|
||||
Present if the item fires any events
|
||||
file <s> File name
|
||||
inherited <[o]|u> Inherited properties (array of doc objects)
|
||||
inheritedevents <[o]|u> Inherited events (array of doc objects)
|
||||
Present if the item has a class, and any item in its inheritance
|
||||
chain fires events
|
||||
inheritedproperties <[o]|u> Inherited properties (array of doc objects)
|
||||
Present if the item has a class, and any item in its inheritance
|
||||
chain has (unshadowed) properties
|
||||
line <n> Line number
|
||||
|
|
@ -39,7 +42,7 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
Present if the `type` of the item is `"function"`.
|
||||
summary <s> One-line summary, with some Markdown
|
||||
See Ox.parseMarkdown for details
|
||||
tests <[o]> Tests (array of test objects)
|
||||
tests <[o]|u> Tests (array of test objects)
|
||||
expected <s> Expected result
|
||||
statement <s> Statement
|
||||
types <[s]> Types of the item
|
||||
|
|
@ -97,12 +100,17 @@ Ox.doc = (function() {
|
|||
var constructors = getConstructors(items), instances = {}, nodes = {};
|
||||
function hasProperty(item, property) {
|
||||
var properties = item.properties || [],
|
||||
inherited = item.inherited ? item.inherited.map(function(v) {
|
||||
return v.properties;
|
||||
}) : [];
|
||||
return Ox.contains(properties.concat(inherited).map(function(property) {
|
||||
return property.name;
|
||||
}), property.name);
|
||||
inheritedproperties = item.inheritedproperties
|
||||
? item.inheritedproperties.map(function(v) {
|
||||
return v.properties;
|
||||
})
|
||||
: [];
|
||||
return Ox.contains(
|
||||
properties.concat(inheritedproperties).map(function(property) {
|
||||
return property.name;
|
||||
}),
|
||||
property.name
|
||||
);
|
||||
}
|
||||
var foo = {};
|
||||
constructors.forEach(function(constructor) {
|
||||
|
|
@ -117,18 +125,23 @@ Ox.doc = (function() {
|
|||
|| Ox.last(items[Ox.indexOf(items, function(item) {
|
||||
return item.name == parentName;
|
||||
})].returns);
|
||||
parent && parent.properties && parent.properties.forEach(function(property) {
|
||||
if (!hasProperty(child, property)) {
|
||||
if (!child.inherited) {
|
||||
child.inherited = [];
|
||||
['properties', 'events'].forEach(function(key) {
|
||||
parent[key] && parent[key].forEach(function(value) {
|
||||
var key_ = 'inherited' + key;
|
||||
if (key == 'events' || !hasProperty(child, value)) {
|
||||
if (!child[key_]) {
|
||||
child[key_] = [];
|
||||
}
|
||||
if (!child[key_].some(function(v) {
|
||||
return v.name == parentName;
|
||||
})) {
|
||||
child[key_].push(
|
||||
Ox.extend({name: parentName}, key, [])
|
||||
);
|
||||
}
|
||||
Ox.last(child[key_])[key].push(value);
|
||||
}
|
||||
if (!child.inherited.some(function(v) {
|
||||
return v.name == parentName;
|
||||
})) {
|
||||
child.inherited.push({name: parentName, properties: []});
|
||||
}
|
||||
Ox.last(child.inherited).properties.push(property);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -225,7 +238,6 @@ Ox.doc = (function() {
|
|||
item.tests = item.tests || [];
|
||||
item.tests.push(parseTest(line));
|
||||
} else if ((subitem = parseItem(line))) {
|
||||
item.name == 'Ox.getset' && Ox.print(line, subitem)
|
||||
if (subitem.signature) {
|
||||
item.returns = item.returns || [];
|
||||
item.returns.push(parseNode(node));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue