Skip to content

Commit 723701f

Browse files
committed
doc data is statically generated
1 parent 71627df commit 723701f

15 files changed

+131
-111
lines changed

src/doc/ExternalDoc.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export default class ExternalDoc extends AbstractDoc
1414
* to detect any unknown tags when a method is missing. Child classes may also add the tags that they support.
1515
*/
1616

17-
/** @ignore */ _tag_external() {}
17+
/** @ignore */ static _tag_external() {}
1818

1919
/** specify ``external`` to kind. */
20-
_$kind()
20+
static _$kind()
2121
{
2222
this._value.kind = 'external';
2323
}
2424

2525
/** specify name to longname */
26-
_$longname()
26+
static _$longname()
2727
{
2828
super._$longname();
2929

@@ -35,13 +35,13 @@ export default class ExternalDoc extends AbstractDoc
3535
}
3636

3737
/** take out self memberof from file path. */
38-
_$memberof()
38+
static _$memberof()
3939
{
4040
this._value.memberof = this._pathResolver.filePath;
4141
}
4242

4343
/** take out self name from tag */
44-
_$name()
44+
static _$name()
4545
{
4646
const value = this._findTagValue(['@external']);
4747

src/doc/FileDoc.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import AbstractDoc from './abstract/AbstractDoc.js';
88
export default class FileDoc extends AbstractDoc
99
{
1010
/**
11-
* Create instance. File docs are the module, so pass `null` as the module ID to AbstractDoc.
11+
* Create doc data statically held. File docs are the module, so pass `null` as the module ID to AbstractDoc.
1212
*
1313
* @param {number} docID - The docID for this doc.
1414
*
@@ -21,34 +21,36 @@ export default class FileDoc extends AbstractDoc
2121
* @param {Tag[]} commentTags - this is tags that self node has.
2222
*
2323
* @param {EventProxy} eventbus - An event proxy for the main eventbus.
24+
*
25+
* @returns {FileDoc}
2426
*/
25-
constructor(docID, ast, node, pathResolver, commentTags = [], eventbus)
27+
static create(docID, ast, node, pathResolver, commentTags = [], eventbus)
2628
{
27-
super(docID, null, ast, node, pathResolver, commentTags, eventbus);
29+
return super.create(docID, null, ast, node, pathResolver, commentTags, eventbus);
2830
}
2931

3032
/** specify file content to value.content */
31-
_$content()
33+
static _$content()
3234
{
3335
const filePath = this._pathResolver.absolutePath;
3436

3537
this._value.content = fs.readFileSync(filePath, { encode: 'utf8' }).toString();
3638
}
3739

3840
/** specify ``file`` to kind. */
39-
_$kind()
41+
static _$kind()
4042
{
4143
this._value.kind = 'file';
4244
}
4345

4446
/** specify name to longname */
45-
_$longname()
47+
static _$longname()
4648
{
4749
this._value.longname = this._pathResolver.filePath;
4850
}
4951

5052
/** take out self name from file path */
51-
_$name()
53+
static _$name()
5254
{
5355
this._value.name = this._pathResolver.filePath;
5456
}

src/doc/MemoryDoc.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import AbstractDoc from './abstract/AbstractDoc.js';
66
export default class MemoryDoc extends AbstractDoc
77
{
88
/**
9-
* Create instance. Memory docs are the module, so pass `null` as the module ID to AbstractDoc.
9+
* Create doc data statically held. Memory docs are the module, so pass `null` as the module ID to AbstractDoc.
1010
*
1111
* @param {number} docID - The docID for this doc.
1212
*
@@ -21,29 +21,33 @@ export default class MemoryDoc extends AbstractDoc
2121
* @param {EventProxy} eventbus - An event proxy for the main eventbus.
2222
*
2323
* @param {String} code - this is the in memory code that defines this doc.
24+
*
25+
* @returns {FileDoc}
2426
*/
25-
constructor(docID, ast, node, pathResolver, commentTags = [], eventbus, code)
27+
static create(docID, ast, node, pathResolver, commentTags = [], eventbus, code)
2628
{
27-
super(docID, null, ast, node, pathResolver, commentTags, eventbus);
29+
super.create(docID, null, ast, node, pathResolver, commentTags, eventbus);
2830

2931
// Must set content directly as all value properties are resolved in AbstractDoc constructor.
3032
this._value.content = code;
33+
34+
return this;
3135
}
3236

3337
/** specify ``memory`` to kind. */
34-
_$kind()
38+
static _$kind()
3539
{
3640
this._value.kind = 'memory';
3741
}
3842

3943
/** specify name to longname */
40-
_$longname()
44+
static _$longname()
4145
{
4246
this._value.longname = 'In memory code';
4347
}
4448

4549
/** take out self name from file path */
46-
_$name()
50+
static _$name()
4751
{
4852
this._value.name = 'In memory code';
4953
}

src/doc/TestFileDoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import FileDoc from './FileDoc.js';
66
export default class TestFileDoc extends FileDoc
77
{
88
/** set ``testFile`` to kind. */
9-
_$kind()
9+
static _$kind()
1010
{
1111
this._value.kind = 'testFile';
1212
}

src/doc/abstract/AbstractAssignmentDoc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export default class AbstractAssignmentDoc extends AbstractModuleDoc
1212
/**
1313
* specify ``variable`` to kind.
1414
*/
15-
_$kind()
15+
static _$kind()
1616
{
1717
this._value.kind = 'variable';
1818
}
1919

2020
/**
2121
* take out self memberof from file path.
2222
*/
23-
_$memberof()
23+
static _$memberof()
2424
{
2525
this._value.memberof = this._pathResolver.filePath;
2626
}

src/doc/abstract/AbstractClassDoc.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class AbstractClassDoc extends AbstractModuleDoc
2727
* @returns {string} selection text
2828
* @private
2929
*/
30-
_readSelection(filePath, line, startColumn, endColumn)
30+
static _readSelection(filePath, line, startColumn, endColumn)
3131
{
3232
const code = fs.readFileSync(filePath).toString();
3333
const lines = code.split('\n');
@@ -47,14 +47,14 @@ export default class AbstractClassDoc extends AbstractModuleDoc
4747
* easy to detect any unknown tags when a method is missing. Child classes may also add the tags that they support.
4848
*/
4949

50-
/** @ignore */ _tag_extend() {}
51-
/** @ignore */ _tag_extends() {}
52-
/** @ignore */ _tag_implement() {}
53-
/** @ignore */ _tag_implements() {}
54-
/** @ignore */ _tag_interface() {}
50+
/** @ignore */ static _tag_extend() {}
51+
/** @ignore */ static _tag_extends() {}
52+
/** @ignore */ static _tag_implement() {}
53+
/** @ignore */ static _tag_implements() {}
54+
/** @ignore */ static _tag_interface() {}
5555

5656
/** for @implements */
57-
_$implements()
57+
static _$implements()
5858
{
5959
const values = this._findAllTagValues(['@implements']);
6060

@@ -72,7 +72,7 @@ export default class AbstractClassDoc extends AbstractModuleDoc
7272
}
7373

7474
/** for @interface */
75-
_$interface()
75+
static _$interface()
7676
{
7777
const tag = this._find(['@interface']);
7878

@@ -94,13 +94,13 @@ export default class AbstractClassDoc extends AbstractModuleDoc
9494
}
9595

9696
/** specify ``class`` to kind. */
97-
_$kind()
97+
static _$kind()
9898
{
9999
this._value.kind = 'class';
100100
}
101101

102102
/** take out self memberof from file path. */
103-
_$memberof()
103+
static _$memberof()
104104
{
105105
this._value.memberof = this._pathResolver.filePath;
106106
}

src/doc/abstract/AbstractClassPropertyDoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import AbstractDoc from './AbstractDoc.js';
1616
export default class AbstractClassPropertyDoc extends AbstractDoc
1717
{
1818
/** specify ``member`` to kind. */
19-
_$kind()
19+
static _$kind()
2020
{
2121
this._value.kind = 'member';
2222
}

0 commit comments

Comments
 (0)