@alloy-js/csharp 0.18.0-dev.5 → 0.18.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/ClassDeclaration.d.ts +8 -2
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +3 -2
- package/dist/src/components/EnumDeclaration.d.ts +2 -2
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/stc/index.d.ts +2 -2
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/modifiers.d.ts +3 -2
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +7 -6
- package/dist/test/class.test.js +52 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/ClassDeclaration.tsx +23 -4
- package/src/components/EnumDeclaration.tsx +2 -2
- package/src/modifiers.ts +22 -21
- package/temp/api.json +370 -176
- package/test/class.test.tsx +40 -10
package/src/modifiers.ts
CHANGED
|
@@ -10,17 +10,13 @@ export interface AccessModifiers {
|
|
|
10
10
|
readonly file?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
.filter((x) => x)
|
|
22
|
-
.join(" ");
|
|
23
|
-
}
|
|
13
|
+
export const getAccessModifier = makeModifiers<AccessModifiers>([
|
|
14
|
+
"public",
|
|
15
|
+
"protected",
|
|
16
|
+
"private",
|
|
17
|
+
"internal",
|
|
18
|
+
"file",
|
|
19
|
+
]);
|
|
24
20
|
|
|
25
21
|
/** Method modifiers. Can only be one. */
|
|
26
22
|
export interface MethodModifiers {
|
|
@@ -30,16 +26,12 @@ export interface MethodModifiers {
|
|
|
30
26
|
readonly virtual?: boolean;
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|
|
40
|
-
.filter((x) => x)
|
|
41
|
-
.join(" ");
|
|
42
|
-
}
|
|
29
|
+
export const getMethodModifier = makeModifiers<MethodModifiers>([
|
|
30
|
+
"abstract",
|
|
31
|
+
"sealed",
|
|
32
|
+
"static",
|
|
33
|
+
"virtual",
|
|
34
|
+
]);
|
|
43
35
|
|
|
44
36
|
export function getAsyncModifier(async?: boolean): string {
|
|
45
37
|
return async ? "async" : "";
|
|
@@ -52,3 +44,12 @@ export function computeModifiersPrefix(
|
|
|
52
44
|
const resolved = modifiers.filter((x) => x);
|
|
53
45
|
return resolved.length > 0 ? resolved.join(" ") + " " : "";
|
|
54
46
|
}
|
|
47
|
+
|
|
48
|
+
export function makeModifiers<T>(obj: Array<keyof T>) {
|
|
49
|
+
return (data: T) => {
|
|
50
|
+
return obj
|
|
51
|
+
.map((key) => (data[key] ? key : undefined))
|
|
52
|
+
.filter((x) => x)
|
|
53
|
+
.join(" ");
|
|
54
|
+
};
|
|
55
|
+
}
|