@alloy-js/csharp 0.18.0-dev.2 → 0.18.0-dev.21

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.
Files changed (158) hide show
  1. package/LICENSE +7 -0
  2. package/dist/src/components/ClassDeclaration.d.ts +74 -0
  3. package/dist/src/components/ClassDeclaration.d.ts.map +1 -0
  4. package/dist/src/components/{Class.js → ClassDeclaration.js} +64 -38
  5. package/dist/src/components/ClassMethod.d.ts +26 -5
  6. package/dist/src/components/ClassMethod.d.ts.map +1 -1
  7. package/dist/src/components/ClassMethod.js +27 -9
  8. package/dist/src/components/EnumDeclaration.d.ts +34 -0
  9. package/dist/src/components/EnumDeclaration.d.ts.map +1 -0
  10. package/dist/src/components/{Enum.js → EnumDeclaration.js} +25 -5
  11. package/dist/src/components/doc/comment.d.ts +70 -0
  12. package/dist/src/components/doc/comment.d.ts.map +1 -0
  13. package/dist/src/components/doc/comment.js +88 -0
  14. package/dist/src/components/doc/comment.test.d.ts +2 -0
  15. package/dist/src/components/doc/comment.test.d.ts.map +1 -0
  16. package/dist/src/components/doc/comment.test.js +348 -0
  17. package/dist/src/components/doc/from-markdown.d.ts +6 -0
  18. package/dist/src/components/doc/from-markdown.d.ts.map +1 -0
  19. package/dist/src/components/doc/from-markdown.js +58 -0
  20. package/dist/src/components/doc/from-markdown.test.d.ts +2 -0
  21. package/dist/src/components/doc/from-markdown.test.d.ts.map +1 -0
  22. package/dist/src/components/doc/from-markdown.test.js +83 -0
  23. package/dist/src/components/index.d.ts +13 -4
  24. package/dist/src/components/index.d.ts.map +1 -1
  25. package/dist/src/components/index.js +14 -5
  26. package/dist/src/components/interface/declaration.d.ts +47 -0
  27. package/dist/src/components/interface/declaration.d.ts.map +1 -0
  28. package/dist/src/components/interface/declaration.js +77 -0
  29. package/dist/src/components/interface/declaration.test.d.ts +2 -0
  30. package/dist/src/components/interface/declaration.test.d.ts.map +1 -0
  31. package/dist/src/components/interface/declaration.test.js +153 -0
  32. package/dist/src/components/interface/method.d.ts +32 -0
  33. package/dist/src/components/interface/method.d.ts.map +1 -0
  34. package/dist/src/components/interface/method.js +68 -0
  35. package/dist/src/components/interface/method.test.d.ts +2 -0
  36. package/dist/src/components/interface/method.test.d.ts.map +1 -0
  37. package/dist/src/components/interface/method.test.js +279 -0
  38. package/dist/src/components/interface/property.d.ts +38 -0
  39. package/dist/src/components/interface/property.d.ts.map +1 -0
  40. package/dist/src/components/interface/property.js +67 -0
  41. package/dist/src/components/interface/property.test.d.ts +2 -0
  42. package/dist/src/components/interface/property.test.d.ts.map +1 -0
  43. package/dist/src/components/interface/property.test.js +165 -0
  44. package/dist/src/components/parameters/parameters.d.ts +19 -0
  45. package/dist/src/components/parameters/parameters.d.ts.map +1 -0
  46. package/dist/src/components/parameters/parameters.js +43 -0
  47. package/dist/src/components/property/property.d.ts +57 -0
  48. package/dist/src/components/property/property.d.ts.map +1 -0
  49. package/dist/src/components/property/property.js +70 -0
  50. package/dist/src/components/property/property.test.d.ts +2 -0
  51. package/dist/src/components/property/property.test.d.ts.map +1 -0
  52. package/dist/src/components/property/property.test.js +218 -0
  53. package/dist/src/components/record/declaration.d.ts +35 -0
  54. package/dist/src/components/record/declaration.d.ts.map +1 -0
  55. package/dist/src/components/record/declaration.js +90 -0
  56. package/dist/src/components/record/declaration.test.d.ts +2 -0
  57. package/dist/src/components/record/declaration.test.d.ts.map +1 -0
  58. package/dist/src/components/record/declaration.test.js +94 -0
  59. package/dist/src/components/stc/index.d.ts +2 -2
  60. package/dist/src/components/stc/index.d.ts.map +1 -1
  61. package/dist/src/components/stc/index.js +2 -2
  62. package/dist/src/components/type-parameters/type-parameter-constraints.d.ts +8 -0
  63. package/dist/src/components/type-parameters/type-parameter-constraints.d.ts.map +1 -0
  64. package/dist/src/components/type-parameters/type-parameter-constraints.js +44 -0
  65. package/dist/src/components/type-parameters/type-parameter-constraints.test.d.ts +2 -0
  66. package/dist/src/components/type-parameters/type-parameter-constraints.test.d.ts.map +1 -0
  67. package/dist/src/components/type-parameters/type-parameter-constraints.test.js +67 -0
  68. package/dist/src/components/type-parameters/type-parameter.d.ts +20 -0
  69. package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -0
  70. package/dist/src/components/type-parameters/type-parameter.js +22 -0
  71. package/dist/src/components/type-parameters/type-parameters.d.ts +17 -0
  72. package/dist/src/components/type-parameters/type-parameters.d.ts.map +1 -0
  73. package/dist/src/components/type-parameters/type-parameters.js +54 -0
  74. package/dist/src/components/type-parameters/type-parameters.test.d.ts +2 -0
  75. package/dist/src/components/type-parameters/type-parameters.test.d.ts.map +1 -0
  76. package/dist/src/components/type-parameters/type-parameters.test.js +48 -0
  77. package/dist/src/components/var/declaration.d.ts +35 -0
  78. package/dist/src/components/var/declaration.d.ts.map +1 -0
  79. package/dist/src/components/var/declaration.js +40 -0
  80. package/dist/src/components/var/declaration.test.d.ts +2 -0
  81. package/dist/src/components/var/declaration.test.d.ts.map +1 -0
  82. package/dist/src/components/var/declaration.test.js +73 -0
  83. package/dist/src/modifiers.d.ts +10 -4
  84. package/dist/src/modifiers.d.ts.map +1 -1
  85. package/dist/src/modifiers.js +9 -32
  86. package/dist/src/name-policy.d.ts +1 -1
  87. package/dist/src/name-policy.d.ts.map +1 -1
  88. package/dist/src/name-policy.js +2 -0
  89. package/dist/test/class-declaration.test.d.ts +2 -0
  90. package/dist/test/class-declaration.test.d.ts.map +1 -0
  91. package/dist/test/class-declaration.test.js +463 -0
  92. package/dist/test/class-method.test.js +37 -14
  93. package/dist/test/enum.test.js +12 -12
  94. package/dist/test/namespace.test.js +8 -8
  95. package/dist/test/project-directory.test.d.ts +2 -0
  96. package/dist/test/project-directory.test.d.ts.map +1 -0
  97. package/dist/test/{projectdirectory.test.js → project-directory.test.js} +8 -8
  98. package/dist/test/sourcefile.test.js +4 -4
  99. package/dist/test/using.test.js +9 -9
  100. package/dist/test/vitest.setup.d.ts +2 -0
  101. package/dist/test/vitest.setup.d.ts.map +1 -0
  102. package/dist/test/vitest.setup.js +1 -0
  103. package/dist/tsconfig.tsbuildinfo +1 -1
  104. package/package.json +21 -21
  105. package/src/components/ClassDeclaration.tsx +213 -0
  106. package/src/components/ClassMethod.tsx +54 -15
  107. package/src/components/{Enum.tsx → EnumDeclaration.tsx} +30 -6
  108. package/src/components/doc/comment.test.tsx +337 -0
  109. package/src/components/doc/comment.tsx +152 -0
  110. package/src/components/doc/from-markdown.test.tsx +103 -0
  111. package/src/components/doc/from-markdown.tsx +58 -0
  112. package/src/components/index.ts +13 -4
  113. package/src/components/interface/declaration.test.tsx +143 -0
  114. package/src/components/interface/declaration.tsx +105 -0
  115. package/src/components/interface/method.test.tsx +278 -0
  116. package/src/components/interface/method.tsx +102 -0
  117. package/src/components/interface/property.test.tsx +144 -0
  118. package/src/components/interface/property.tsx +107 -0
  119. package/src/components/parameters/parameters.tsx +74 -0
  120. package/src/components/property/property.test.tsx +187 -0
  121. package/src/components/property/property.tsx +146 -0
  122. package/src/components/record/declaration.test.tsx +73 -0
  123. package/src/components/record/declaration.tsx +109 -0
  124. package/src/components/stc/index.ts +2 -2
  125. package/src/components/type-parameters/type-parameter-constraints.test.tsx +93 -0
  126. package/src/components/type-parameters/type-parameter-constraints.tsx +46 -0
  127. package/src/components/type-parameters/type-parameter.tsx +35 -0
  128. package/src/components/type-parameters/type-parameters.test.tsx +46 -0
  129. package/src/components/type-parameters/type-parameters.tsx +63 -0
  130. package/src/components/var/declaration.test.tsx +59 -0
  131. package/src/components/var/declaration.tsx +47 -0
  132. package/src/modifiers.ts +25 -42
  133. package/src/name-policy.ts +5 -0
  134. package/temp/api.json +5228 -686
  135. package/test/class-declaration.test.tsx +418 -0
  136. package/test/class-method.test.tsx +24 -14
  137. package/test/enum.test.tsx +11 -11
  138. package/test/namespace.test.tsx +4 -4
  139. package/test/{projectdirectory.test.tsx → project-directory.test.tsx} +4 -4
  140. package/test/sourcefile.test.tsx +2 -2
  141. package/test/using.test.tsx +9 -9
  142. package/test/vitest.setup.ts +1 -0
  143. package/vitest.config.ts +3 -0
  144. package/dist/src/components/Class.d.ts +0 -26
  145. package/dist/src/components/Class.d.ts.map +0 -1
  146. package/dist/src/components/Enum.d.ts +0 -15
  147. package/dist/src/components/Enum.d.ts.map +0 -1
  148. package/dist/src/components/Parameters.d.ts +0 -13
  149. package/dist/src/components/Parameters.d.ts.map +0 -1
  150. package/dist/src/components/Parameters.js +0 -34
  151. package/dist/test/class.test.d.ts +0 -2
  152. package/dist/test/class.test.d.ts.map +0 -1
  153. package/dist/test/class.test.js +0 -298
  154. package/dist/test/projectdirectory.test.d.ts +0 -2
  155. package/dist/test/projectdirectory.test.d.ts.map +0 -1
  156. package/src/components/Class.tsx +0 -149
  157. package/src/components/Parameters.tsx +0 -51
  158. package/test/class.test.tsx +0 -292
@@ -0,0 +1,213 @@
1
+ import * as core from "@alloy-js/core";
2
+ import { join } from "@alloy-js/core";
3
+ import {
4
+ AccessModifiers,
5
+ computeModifiersPrefix,
6
+ getAccessModifier,
7
+ makeModifiers,
8
+ } from "../modifiers.js";
9
+ import { CSharpElements, useCSharpNamePolicy } from "../name-policy.js";
10
+ import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
11
+ import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
12
+ import { DocWhen } from "./doc/comment.jsx";
13
+ import { Name } from "./Name.jsx";
14
+ import { ParameterProps, Parameters } from "./parameters/parameters.jsx";
15
+ import { TypeParameterConstraints } from "./type-parameters/type-parameter-constraints.jsx";
16
+ import { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
17
+ import { TypeParameters } from "./type-parameters/type-parameters.jsx";
18
+
19
+ export interface ClassModifiers {
20
+ readonly abstract?: boolean;
21
+ readonly partial?: boolean;
22
+ readonly sealed?: boolean;
23
+ readonly static?: boolean;
24
+ }
25
+
26
+ const getClassModifiers = makeModifiers<ClassModifiers>([
27
+ "abstract",
28
+ "partial",
29
+ "sealed",
30
+ "static",
31
+ ]);
32
+
33
+ // properties for creating a class
34
+ export interface ClassDeclarationProps
35
+ extends Omit<core.DeclarationProps, "nameKind">,
36
+ AccessModifiers,
37
+ ClassModifiers {
38
+ name: string;
39
+ /** Doc comment */
40
+ doc?: core.Children;
41
+ refkey?: core.Refkey;
42
+
43
+ /**
44
+ * Type parameters for the class
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <ClassDeclaration name="MyClass" typeParameters={["T"]} />
49
+ * ```
50
+ * This will produce:
51
+ * ```csharp
52
+ * public class MyClass<T>
53
+ * ```
54
+ */
55
+ typeParameters?: (string | TypeParameterProps)[];
56
+
57
+ /** Base class that this class extends */
58
+ baseType?: core.Children;
59
+
60
+ /** Interfaces this class implements */
61
+ interfaceTypes?: core.Children[];
62
+ }
63
+
64
+ /**
65
+ * CSharp class declaration.
66
+ * @example
67
+ * ```tsx
68
+ * <ClassDeclaration public name="MyClass">
69
+ * <ClassMember public name="MyField" type="int" />
70
+ * <ClassConstructor>
71
+ * <Parameter name="value" type="int" />
72
+ * this.MyField = value;
73
+ * </ClassConstructor>
74
+ * </ClassDeclaration>
75
+ * ```
76
+ * This will produce:
77
+ * ```csharp
78
+ * public class MyClass
79
+ * {
80
+ * public int MyField;
81
+ * public MyClass(int value)
82
+ * {
83
+ * this.MyField = value;
84
+ * }
85
+ * }
86
+ * ```
87
+ */
88
+ export function ClassDeclaration(props: ClassDeclarationProps) {
89
+ const name = useCSharpNamePolicy().getName(props.name!, "class");
90
+
91
+ const thisClassSymbol = new CSharpOutputSymbol(name, {
92
+ refkeys: props.refkey,
93
+ });
94
+
95
+ // this creates a new scope for the class definition.
96
+ // members will automatically "inherit" this scope so
97
+ // that refkeys to them will produce the fully-qualified
98
+ // name e.g. Foo.Bar.
99
+ const thisClassScope = new CSharpMemberScope("class-decl", {
100
+ owner: thisClassSymbol,
101
+ });
102
+
103
+ const bases = [
104
+ ...(props.baseType ? [props.baseType] : []),
105
+ ...(props.interfaceTypes || []),
106
+ ];
107
+ const base =
108
+ bases.length > 0 ? <> : {join(bases, { joiner: ", " })}</> : null;
109
+ const modifiers = computeModifiersPrefix([
110
+ getAccessModifier(props),
111
+ getClassModifiers(props),
112
+ ]);
113
+ return (
114
+ <core.Declaration symbol={thisClassSymbol}>
115
+ <DocWhen doc={props.doc} />
116
+ {modifiers}class <Name />
117
+ {props.typeParameters && (
118
+ <TypeParameters parameters={props.typeParameters} />
119
+ )}
120
+ {base}
121
+ {props.typeParameters && (
122
+ <TypeParameterConstraints parameters={props.typeParameters} />
123
+ )}
124
+ {!props.children && ";"}
125
+ {props.children && (
126
+ <core.Block newline>
127
+ <core.Scope value={thisClassScope}>{props.children}</core.Scope>
128
+ </core.Block>
129
+ )}
130
+ </core.Declaration>
131
+ );
132
+ }
133
+
134
+ export interface ClassConstructorProps extends AccessModifiers {
135
+ parameters?: Array<ParameterProps>;
136
+ refkey?: core.Refkey;
137
+ symbol?: core.OutputSymbol;
138
+ children?: core.Children;
139
+ }
140
+
141
+ // a C# class constructor
142
+ export function ClassConstructor(props: ClassConstructorProps) {
143
+ const scope = useCSharpScope();
144
+ if (scope.kind !== "member" || scope.name !== "class-decl") {
145
+ throw new Error(
146
+ "can't define a class constructor outside of a class-decl scope",
147
+ );
148
+ }
149
+
150
+ // fetch the class name from the scope
151
+ const name = useCSharpNamePolicy().getName(scope.owner!.name, "class-method");
152
+ const ctorSymbol = new CSharpOutputSymbol(name, {
153
+ scope,
154
+ refkeys: props.refkey ?? core.refkey(name),
155
+ });
156
+
157
+ // scope for ctor declaration
158
+ const ctorDeclScope = new CSharpMemberScope("constructor-decl", {
159
+ owner: ctorSymbol,
160
+ });
161
+
162
+ const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
163
+
164
+ // note that scope wraps the ctor decl so that the params get the correct scope
165
+ return (
166
+ <core.Declaration symbol={ctorSymbol}>
167
+ <core.Scope value={ctorDeclScope}>
168
+ {modifiers}
169
+ <Name />
170
+ <Parameters parameters={props.parameters} />
171
+ <core.Block newline>{props.children}</core.Block>
172
+ </core.Scope>
173
+ </core.Declaration>
174
+ );
175
+ }
176
+
177
+ // properties for creating a class member
178
+ export interface ClassMemberProps extends AccessModifiers {
179
+ name: string;
180
+ type: core.Children;
181
+ refkey?: core.Refkey;
182
+ /** Doc comment */
183
+ doc?: core.Children;
184
+ }
185
+
186
+ // a C# class member (i.e. a field within a class like "private int count")
187
+ export function ClassMember(props: ClassMemberProps) {
188
+ let nameElement: CSharpElements = "class-member-private";
189
+ if (props.public) {
190
+ nameElement = "class-member-public";
191
+ }
192
+ const name = useCSharpNamePolicy().getName(props.name, nameElement);
193
+ const scope = useCSharpScope();
194
+ if (scope.kind !== "member" || scope.name !== "class-decl") {
195
+ throw new Error(
196
+ "can't define a class member outside of a class-decl scope",
197
+ );
198
+ }
199
+
200
+ const memberSymbol = new CSharpOutputSymbol(name, {
201
+ scope,
202
+ refkeys: props.refkey ?? core.refkey(props.name),
203
+ });
204
+
205
+ const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
206
+ return (
207
+ <core.Declaration symbol={memberSymbol}>
208
+ <DocWhen doc={props.doc} />
209
+ {modifiers}
210
+ {props.type} <Name />
211
+ </core.Declaration>
212
+ );
213
+ }
@@ -7,25 +7,43 @@ import {
7
7
  Scope,
8
8
  } from "@alloy-js/core";
9
9
  import {
10
- AccessModifier,
10
+ AccessModifiers,
11
11
  computeModifiersPrefix,
12
12
  getAccessModifier,
13
13
  getAsyncModifier,
14
- getMethodModifier,
15
- MethodModifier,
14
+ makeModifiers,
16
15
  } from "../modifiers.js";
17
16
  import { useCSharpNamePolicy } from "../name-policy.js";
18
17
  import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
19
18
  import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
20
- import { ParameterProps, Parameters } from "./Parameters.jsx";
19
+ import { DocWhen } from "./doc/comment.jsx";
20
+ import { ParameterProps, Parameters } from "./parameters/parameters.jsx";
21
+ import { TypeParameterConstraints } from "./type-parameters/type-parameter-constraints.jsx";
22
+ import { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
23
+ import { TypeParameters } from "./type-parameters/type-parameters.jsx";
24
+
25
+ /** Method modifiers. Can only be one. */
26
+ export interface ClassMethodModifiers {
27
+ readonly abstract?: boolean;
28
+ readonly sealed?: boolean;
29
+ readonly static?: boolean;
30
+ readonly virtual?: boolean;
31
+ }
32
+
33
+ const getMethodModifier = makeModifiers<ClassMethodModifiers>([
34
+ "abstract",
35
+ "sealed",
36
+ "static",
37
+ "virtual",
38
+ ]);
21
39
 
22
40
  // properties for creating a method
23
- export interface ClassMethodProps {
41
+ export interface ClassMethodProps
42
+ extends AccessModifiers,
43
+ ClassMethodModifiers {
24
44
  name: string;
25
45
  refkey?: Refkey;
26
46
  children?: Children;
27
- accessModifier?: AccessModifier;
28
- methodModifier?: MethodModifier;
29
47
  parameters?: Array<ParameterProps>;
30
48
  returns?: Children;
31
49
 
@@ -33,6 +51,23 @@ export interface ClassMethodProps {
33
51
  * If true, the method will be declared as an async method.
34
52
  */
35
53
  async?: boolean;
54
+
55
+ /** Doc comment */
56
+ doc?: Children;
57
+
58
+ /**
59
+ * Type parameters for the method
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * <InterfaceMethod name="Test" typeParameters={["T"]} />
64
+ * ```
65
+ * This will produce:
66
+ * ```csharp
67
+ * public void Test<T>()
68
+ * ```
69
+ */
70
+ typeParameters?: (TypeParameterProps | string)[];
36
71
  }
37
72
 
38
73
  // a C# class method
@@ -53,24 +88,28 @@ export function ClassMethod(props: ClassMethodProps) {
53
88
  owner: methodSymbol,
54
89
  });
55
90
 
56
- const params =
57
- props.parameters ? <Parameters parameters={props.parameters} /> : "";
58
91
  const returns = props.returns ?? (props.async ? "Task" : "void");
59
92
 
60
93
  const modifiers = computeModifiersPrefix([
61
- getAccessModifier(props.accessModifier),
62
- getMethodModifier(props.methodModifier),
94
+ getAccessModifier(props),
95
+ getMethodModifier(props),
63
96
  getAsyncModifier(props.async),
64
97
  ]);
65
98
  // note that scope wraps the method decl so that the params get the correct scope
66
99
  return (
67
100
  <MemberDeclaration symbol={methodSymbol}>
68
101
  <Scope value={methodScope}>
102
+ <DocWhen doc={props.doc} />
69
103
  {modifiers}
70
- {returns} {name}({params})
71
- {props.methodModifier === "abstract" ?
72
- ";"
73
- : <Block newline>{props.children}</Block>}
104
+ {returns} {name}
105
+ {props.typeParameters && (
106
+ <TypeParameters parameters={props.typeParameters} />
107
+ )}
108
+ <Parameters parameters={props.parameters} />
109
+ {props.typeParameters && (
110
+ <TypeParameterConstraints parameters={props.typeParameters} />
111
+ )}
112
+ {props.abstract ? ";" : <Block newline>{props.children}</Block>}
74
113
  </Scope>
75
114
  </MemberDeclaration>
76
115
  );
@@ -1,20 +1,42 @@
1
1
  import * as core from "@alloy-js/core";
2
- import { AccessModifier, getAccessModifier } from "../modifiers.js";
2
+ import {
3
+ AccessModifiers,
4
+ computeModifiersPrefix,
5
+ getAccessModifier,
6
+ } from "../modifiers.js";
3
7
  import { useCSharpNamePolicy } from "../name-policy.js";
4
8
  import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
5
9
  import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
6
10
  import { Name } from "./Name.jsx";
7
11
 
8
12
  // properties for creating an enum
9
- export interface EnumProps {
13
+ export interface EnumDeclarationProps extends AccessModifiers {
10
14
  name: string;
11
15
  refkey?: core.Refkey;
12
16
  children?: core.Children;
13
- accessModifier?: AccessModifier;
14
17
  }
15
18
 
16
- // a C# enum declaration
17
- export function Enum(props: EnumProps) {
19
+ /**
20
+ * A C# enum declaration
21
+ * @example
22
+ * ```tsx
23
+ * <EnumDeclaration public name="Color">
24
+ * <EnumMember name="Red" />
25
+ * <EnumMember name="Green" />
26
+ * <EnumMember name="Blue" />
27
+ * </EnumDeclaration>
28
+ * ```
29
+ * This will produce:
30
+ * ```csharp
31
+ * public enum Color
32
+ * {
33
+ * Red,
34
+ * Green,
35
+ * Blue
36
+ * }
37
+ * ```
38
+ */
39
+ export function EnumDeclaration(props: EnumDeclarationProps) {
18
40
  const name = useCSharpNamePolicy().getName(props.name!, "enum");
19
41
  const scope = useCSharpScope();
20
42
 
@@ -32,10 +54,12 @@ export function Enum(props: EnumProps) {
32
54
  owner: thisEnumSymbol,
33
55
  });
34
56
 
57
+ const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
58
+
35
59
  if (thisEnumScope.owner)
36
60
  return (
37
61
  <core.Declaration symbol={thisEnumSymbol}>
38
- {getAccessModifier(props.accessModifier)}enum <Name />
62
+ {modifiers}enum <Name />
39
63
  {!props.children && ";"}
40
64
  {props.children && (
41
65
  <core.Scope value={thisEnumScope}>