-
Notifications
You must be signed in to change notification settings - Fork 246
/
enum.ts
37 lines (30 loc) · 1013 Bytes
/
enum.ts
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
import * as jsii from '@jsii/spec';
import { Assembly } from './assembly';
import { Docs, Documentable } from './docs';
import { Type } from './type';
import { TypeSystem } from './type-system';
export class EnumType extends Type {
public constructor(
public system: TypeSystem,
public assembly: Assembly,
public readonly spec: jsii.EnumType) {
super(system, assembly, spec);
}
public get members() {
return this.spec.members.map(m => new EnumMember(this, m));
}
public isEnumType() {
return true;
}
}
export class EnumMember implements Documentable {
public readonly name: string;
public readonly docs: Docs;
public constructor(
public readonly enumType: EnumType, memberSpec: jsii.EnumMember) {
this.name = memberSpec.name;
this.docs = new Docs(this.system, this, memberSpec.docs ?? {}, this.enumType.docs);
}
public get system(): TypeSystem { return this.enumType.system; }
public get assembly(): Assembly { return this.enumType.assembly; }
}