-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathModuleSpec.ts
More file actions
58 lines (44 loc) · 1.39 KB
/
ModuleSpec.ts
File metadata and controls
58 lines (44 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This file is part of readts, copyright (c) 2016 BusFaster Ltd.
// Released under the MIT license, see LICENSE.
import * as ts from 'typescript';
import * as readts from './index';
import { SymbolSpec } from './Parser';
/** Module or source file. */
export class ModuleSpec {
/** Add an exported enum. @ignore internal use. */
addEnum(spec: readts.EnumSpec) {
this.enumList.push(spec);
}
/** Add an exported class. @ignore internal use. */
addClass(spec: readts.ClassSpec) {
this.classList.push(spec);
}
/** Add an exported interface. @ignore internal use. */
addInterface(spec: readts.ClassSpec) {
this.interfaceList.push(spec);
}
/** Add an exported function. @ignore internal use. */
addFunction(spec: readts.FunctionSpec) {
this.functionList.push(spec);
}
/** Test if nothing is exported. */
isEmpty() {
return(
!this.enumList.length &&
!this.classList.length &&
!this.interfaceList.length &&
!this.functionList.length &&
!this.variableList.length
);
}
/** Definitions of exported enums. */
enumList: readts.EnumSpec[] = [];
/** Definitions of exported classes. */
classList: readts.ClassSpec[] = [];
/** Definitions of exported interfaces. */
interfaceList: readts.ClassSpec[] = [];
/** Definitions of exported functions. */
functionList: readts.FunctionSpec[] = [];
/** Definitions of exported variables. */
variableList: readts.IdentifierSpec[] = [];
}