Skip to content

Commit 4a69d77

Browse files
committed
style: fix whitespace and comments for 'TroupeType'
1 parent c2c8b68 commit 4a69d77

File tree

1 file changed

+46
-28
lines changed

1 file changed

+46
-28
lines changed

rt/src/base/TroupeTypes.mts

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,58 @@
1+
/**
2+
* Enum value to identify/encode the different Troupe objects.
3+
*/
14
export const enum TroupeType {
2-
UNIT=0,
3-
BOOLEAN=1,
4-
NUMBER=2,
5-
STRING=3,
6-
PROCESS_ID=4,
7-
LEVEL=5,
8-
AUTHORITY=6,
9-
CAPABILITY=7,
10-
ATOM=8,
11-
/* up until this point only base types */
12-
13-
/* aggregate types */
14-
CLOSURE=100,
15-
LVAL=101, // TODO: AA; 2020-03-03 ; this should be only used for transports;
16-
TUPLE=102,
17-
LIST=103,
18-
RECORD=104,
19-
/* meaningless to serialize */
20-
LOCALOBJECT=200
5+
// --------------------------------------------------------------------------
6+
// base types
7+
UNIT = 0,
8+
BOOLEAN = 1,
9+
NUMBER = 2,
10+
STRING = 3,
11+
PROCESS_ID = 4,
12+
LEVEL = 5,
13+
AUTHORITY = 6,
14+
CAPABILITY = 7,
15+
ATOM = 8,
16+
17+
// --------------------------------------------------------------------------
18+
// aggregate types
19+
CLOSURE = 100,
20+
LVAL = 101, // TODO (AA; 2020-03-03): should be only used for transports
21+
TUPLE = 102,
22+
LIST = 103,
23+
RECORD = 104,
24+
25+
// --------------------------------------------------------------------------
26+
// unserializable objects type
27+
LOCALOBJECT = 200
2128
}
2229

23-
export const enum ClosureType {
24-
/* okay to serialize */
25-
REGULARFN = 0,
30+
/**
31+
* Enum value to identify the diffrent types of Troupe objects, i.e. Troupe
32+
* objects with `TroupeType.CLOSURE`.
33+
*/
34+
export const enum ClosureType {
35+
// okay to serialize
36+
REGULARFN = 0,
2637

27-
/* meaningless to serialize */
28-
BUILTINFN = 1,
29-
SANDBOXKONT = 2 ,
30-
SERVICEFN = 3
38+
// not to be serialized
39+
BUILTINFN = 1,
40+
SANDBOXKONT = 2,
41+
SERVICEFN = 3,
3142
}
3243

33-
export function isSerializableClosure (ct: ClosureType) {
44+
/**
45+
* Identifies whether the given closure type, `ct`, is intended for
46+
* serialization.
47+
*/
48+
export function isSerializableClosure(ct: ClosureType) : boolean {
3449
return (ct === ClosureType.REGULARFN);
3550
}
3651

37-
export function getTroupeType (x: any) : TroupeType {
52+
/**
53+
* Infer the `TroupeType` of a given object.
54+
*/
55+
export function getTroupeType(x: any) : TroupeType {
3856
// Troupe Types
3957
if (x._troupeType !== undefined) {
4058
return x._troupeType;

0 commit comments

Comments
 (0)