[doclint] parse getters as properties

From the api standpoint, there's no difference between property
and a getter.

References #14.
This commit is contained in:
Andrey Lushnikov 2017-07-13 23:11:39 -07:00
parent 45c20c7dad
commit 67d109862a
4 changed files with 13 additions and 4 deletions

View File

@ -86,7 +86,7 @@
* [headers.values()](#headersvalues)
- [class: Body](#class-body)
* [body.arrayBuffer()](#bodyarraybuffer)
* [body.bodyUsed()](#bodybodyused)
* [body.bodyUsed](#bodybodyused)
* [body.buffer()](#bodybuffer)
* [body.json()](#bodyjson)
* [body.text()](#bodytext)
@ -449,7 +449,7 @@ If there's already a header with name `name`, the header gets overwritten.
### class: Body
#### body.arrayBuffer()
#### body.bodyUsed()
#### body.bodyUsed
#### body.buffer()
#### body.json()
#### body.text()

View File

@ -30,10 +30,15 @@ class JSOutline {
_onMethodDefinition(node) {
console.assert(this._currentClassName !== null);
console.assert(node.value.type === 'FunctionExpression');
let methodName = this._extractText(node.key);
if (node.kind === 'get') {
let property = Documentation.Member.createProperty(methodName);
this._currentClassMembers.push(property);
return;
}
const args = [];
for (let param of node.value.params)
args.push(new Documentation.Argument(this._extractText(param)));
let methodName = this._extractText(node.key);
let method = Documentation.Member.createMethod(methodName, args);
this._currentClassMembers.push(method);
// Extract properties from constructor.

View File

@ -4,4 +4,7 @@ class Foo {
stop() {
}
get zzz() {
}
}

View File

@ -1,2 +1,3 @@
[MarkDown] Non-existing method found: Foo.proceed()
[MarkDown] Method not found: Foo.stop()
[MarkDown] Method not found: Foo.stop()
[MarkDown] Property not found: Foo.zzz