@alloy-js/csharp 0.20.0-dev.3 → 0.20.0-dev.4

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 (249) hide show
  1. package/dist/src/components/Declaration.d.ts +2 -2
  2. package/dist/src/components/Declaration.d.ts.map +1 -1
  3. package/dist/src/components/Declaration.js +3 -13
  4. package/dist/src/components/Reference.d.ts.map +1 -1
  5. package/dist/src/components/Reference.js +5 -1
  6. package/dist/src/components/SourceFile.d.ts +8 -9
  7. package/dist/src/components/SourceFile.d.ts.map +1 -1
  8. package/dist/src/components/SourceFile.js +69 -45
  9. package/dist/src/components/UsingDirective.d.ts +5 -1
  10. package/dist/src/components/UsingDirective.d.ts.map +1 -1
  11. package/dist/src/components/UsingDirective.js +3 -1
  12. package/dist/src/components/class/declaration.d.ts +2 -2
  13. package/dist/src/components/class/declaration.d.ts.map +1 -1
  14. package/dist/src/components/class/declaration.js +18 -32
  15. package/dist/src/components/class/declaration.test.js +171 -193
  16. package/dist/src/components/constructor/constructor.d.ts.map +1 -1
  17. package/dist/src/components/constructor/constructor.js +11 -16
  18. package/dist/src/components/constructor/constructor.test.js +10 -19
  19. package/dist/src/components/{EnumDeclaration.d.ts → enum/declaration.d.ts} +6 -11
  20. package/dist/src/components/enum/declaration.d.ts.map +1 -0
  21. package/dist/src/components/enum/declaration.js +54 -0
  22. package/dist/src/components/enum/declaration.ref.test.d.ts +2 -0
  23. package/dist/src/components/enum/declaration.ref.test.d.ts.map +1 -0
  24. package/dist/src/components/enum/declaration.ref.test.js +120 -0
  25. package/dist/src/components/enum/declaration.test.d.ts +2 -0
  26. package/dist/src/components/enum/declaration.test.d.ts.map +1 -0
  27. package/dist/src/components/enum/declaration.test.js +39 -0
  28. package/dist/src/components/enum/member.d.ts +7 -0
  29. package/dist/src/components/enum/member.d.ts.map +1 -0
  30. package/dist/src/components/enum/member.js +29 -0
  31. package/dist/src/components/enum/member.test.d.ts +2 -0
  32. package/dist/src/components/enum/member.test.d.ts.map +1 -0
  33. package/dist/src/components/enum/member.test.js +28 -0
  34. package/dist/src/components/field/field.d.ts.map +1 -1
  35. package/dist/src/components/field/field.js +9 -14
  36. package/dist/src/components/field/field.test.js +7 -7
  37. package/dist/src/components/index.d.ts +5 -2
  38. package/dist/src/components/index.d.ts.map +1 -1
  39. package/dist/src/components/index.js +5 -2
  40. package/dist/src/components/interface/declaration.d.ts.map +1 -1
  41. package/dist/src/components/interface/declaration.js +19 -21
  42. package/dist/src/components/interface/declaration.test.js +26 -35
  43. package/dist/src/components/interface/method.d.ts.map +1 -1
  44. package/dist/src/components/interface/method.js +7 -15
  45. package/dist/src/components/interface/method.test.js +38 -47
  46. package/dist/src/components/interface/property.d.ts.map +1 -1
  47. package/dist/src/components/interface/property.js +21 -36
  48. package/dist/src/components/interface/property.test.js +11 -11
  49. package/dist/src/components/lexical-scope.d.ts +8 -0
  50. package/dist/src/components/lexical-scope.d.ts.map +1 -0
  51. package/dist/src/components/lexical-scope.js +24 -0
  52. package/dist/src/components/method/method.d.ts +5 -2
  53. package/dist/src/components/method/method.d.ts.map +1 -1
  54. package/dist/src/components/method/method.js +7 -13
  55. package/dist/src/components/method/method.test.js +11 -11
  56. package/dist/src/components/method-scope.d.ts +8 -0
  57. package/dist/src/components/method-scope.d.ts.map +1 -0
  58. package/dist/src/components/method-scope.js +24 -0
  59. package/dist/src/components/namespace-scopes.d.ts +13 -0
  60. package/dist/src/components/namespace-scopes.d.ts.map +1 -0
  61. package/dist/src/components/namespace-scopes.js +44 -0
  62. package/dist/src/components/namespace.d.ts +7 -0
  63. package/dist/src/components/namespace.d.ts.map +1 -0
  64. package/dist/src/components/namespace.js +46 -0
  65. package/dist/src/components/namespace.ref.test.d.ts +2 -0
  66. package/dist/src/components/namespace.ref.test.d.ts.map +1 -0
  67. package/dist/src/components/namespace.ref.test.js +181 -0
  68. package/dist/src/components/namespace.test.d.ts.map +1 -0
  69. package/dist/src/components/namespace.test.js +78 -0
  70. package/dist/src/components/parameters/parameters.d.ts +2 -2
  71. package/dist/src/components/parameters/parameters.d.ts.map +1 -1
  72. package/dist/src/components/parameters/parameters.js +12 -11
  73. package/dist/src/components/parameters/parameters.test.d.ts +2 -0
  74. package/dist/src/components/parameters/parameters.test.d.ts.map +1 -0
  75. package/dist/src/components/parameters/parameters.test.js +87 -0
  76. package/dist/src/components/property/property.d.ts.map +1 -1
  77. package/dist/src/components/property/property.js +21 -36
  78. package/dist/src/components/property/property.test.js +14 -14
  79. package/dist/src/components/record/declaration.d.ts.map +1 -1
  80. package/dist/src/components/record/declaration.js +8 -12
  81. package/dist/src/components/record/declaration.test.js +6 -13
  82. package/dist/src/components/struct/declaration.d.ts.map +1 -1
  83. package/dist/src/components/struct/declaration.js +4 -6
  84. package/dist/src/components/struct/declaration.test.js +30 -39
  85. package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
  86. package/dist/src/components/type-parameters/type-parameter.js +7 -10
  87. package/dist/src/components/type-parameters/type-parameters.test.js +3 -3
  88. package/dist/src/components/var/declaration.d.ts.map +1 -1
  89. package/dist/src/components/var/declaration.js +6 -8
  90. package/dist/src/components/var/declaration.test.js +11 -20
  91. package/dist/src/contexts/global-namespace.d.ts +5 -0
  92. package/dist/src/contexts/global-namespace.d.ts.map +1 -0
  93. package/dist/src/contexts/global-namespace.js +24 -0
  94. package/dist/src/contexts/namespace.d.ts +8 -0
  95. package/dist/src/contexts/namespace.d.ts.map +1 -0
  96. package/dist/src/contexts/namespace.js +5 -0
  97. package/dist/src/index.d.ts +1 -0
  98. package/dist/src/index.d.ts.map +1 -1
  99. package/dist/src/index.js +1 -0
  100. package/dist/src/modifiers.d.ts +11 -0
  101. package/dist/src/modifiers.d.ts.map +1 -1
  102. package/dist/src/scopes/class.d.ts +10 -0
  103. package/dist/src/scopes/class.d.ts.map +1 -0
  104. package/dist/src/scopes/class.js +10 -0
  105. package/dist/src/scopes/contexts.d.ts +9 -0
  106. package/dist/src/scopes/contexts.d.ts.map +1 -0
  107. package/dist/src/scopes/contexts.js +33 -0
  108. package/dist/src/scopes/csharp.d.ts +8 -0
  109. package/dist/src/scopes/csharp.d.ts.map +1 -0
  110. package/dist/src/scopes/csharp.js +11 -0
  111. package/dist/src/scopes/factories.d.ts +9 -0
  112. package/dist/src/scopes/factories.d.ts.map +1 -0
  113. package/dist/src/scopes/factories.js +23 -0
  114. package/dist/src/scopes/index.d.ts +10 -0
  115. package/dist/src/scopes/index.d.ts.map +1 -0
  116. package/dist/src/scopes/index.js +9 -0
  117. package/dist/src/scopes/lexical.d.ts +7 -0
  118. package/dist/src/scopes/lexical.d.ts.map +1 -0
  119. package/dist/src/scopes/lexical.js +7 -0
  120. package/dist/src/scopes/method.d.ts +9 -0
  121. package/dist/src/scopes/method.d.ts.map +1 -0
  122. package/dist/src/scopes/method.js +13 -0
  123. package/dist/src/scopes/named-type.d.ts +22 -0
  124. package/dist/src/scopes/named-type.d.ts.map +1 -0
  125. package/dist/src/scopes/named-type.js +32 -0
  126. package/dist/src/scopes/namespace.d.ts +11 -0
  127. package/dist/src/scopes/namespace.d.ts.map +1 -0
  128. package/dist/src/scopes/namespace.js +38 -0
  129. package/dist/src/scopes/source-file.d.ts +16 -0
  130. package/dist/src/scopes/source-file.d.ts.map +1 -0
  131. package/dist/src/scopes/source-file.js +43 -0
  132. package/dist/src/symbols/csharp.d.ts +76 -0
  133. package/dist/src/symbols/csharp.d.ts.map +1 -0
  134. package/dist/src/symbols/csharp.js +222 -0
  135. package/dist/src/symbols/factories.d.ts +25 -0
  136. package/dist/src/symbols/factories.d.ts.map +1 -0
  137. package/dist/src/symbols/factories.js +86 -0
  138. package/dist/src/symbols/index.d.ts +5 -2
  139. package/dist/src/symbols/index.d.ts.map +1 -1
  140. package/dist/src/symbols/index.js +6 -3
  141. package/dist/src/symbols/method.d.ts +13 -0
  142. package/dist/src/symbols/method.d.ts.map +1 -0
  143. package/dist/src/symbols/method.js +15 -0
  144. package/dist/src/symbols/named-type.d.ts +19 -0
  145. package/dist/src/symbols/named-type.d.ts.map +1 -0
  146. package/dist/src/symbols/named-type.js +30 -0
  147. package/dist/src/symbols/namespace.d.ts +22 -0
  148. package/dist/src/symbols/namespace.d.ts.map +1 -0
  149. package/dist/src/symbols/namespace.js +44 -0
  150. package/dist/src/symbols/reference.d.ts +2 -2
  151. package/dist/src/symbols/reference.d.ts.map +1 -1
  152. package/dist/src/symbols/reference.js +36 -43
  153. package/dist/test/project-directory.test.js +12 -16
  154. package/dist/test/sourcefile.test.js +7 -19
  155. package/dist/test/using.test.js +18 -16
  156. package/dist/test/utils.js +2 -2
  157. package/dist/tsconfig.tsbuildinfo +1 -1
  158. package/package.json +6 -2
  159. package/src/components/Declaration.tsx +3 -6
  160. package/src/components/Reference.tsx +3 -1
  161. package/src/components/SourceFile.tsx +68 -55
  162. package/src/components/UsingDirective.tsx +12 -2
  163. package/src/components/class/declaration.test.tsx +120 -143
  164. package/src/components/class/declaration.tsx +19 -32
  165. package/src/components/constructor/constructor.test.tsx +10 -16
  166. package/src/components/constructor/constructor.tsx +13 -27
  167. package/src/components/enum/declaration.ref.test.tsx +93 -0
  168. package/src/components/enum/declaration.test.tsx +34 -0
  169. package/src/components/enum/declaration.tsx +65 -0
  170. package/src/components/enum/member.test.tsx +24 -0
  171. package/src/components/enum/member.tsx +36 -0
  172. package/src/components/field/field.test.tsx +7 -7
  173. package/src/components/field/field.tsx +12 -14
  174. package/src/components/index.ts +5 -2
  175. package/src/components/interface/declaration.test.tsx +26 -32
  176. package/src/components/interface/declaration.tsx +16 -18
  177. package/src/components/interface/method.test.tsx +38 -44
  178. package/src/components/interface/method.tsx +7 -19
  179. package/src/components/interface/property.test.tsx +11 -11
  180. package/src/components/interface/property.tsx +15 -33
  181. package/src/components/lexical-scope.tsx +29 -0
  182. package/src/components/method/method.test.tsx +11 -11
  183. package/src/components/method/method.tsx +12 -18
  184. package/src/components/method-scope.tsx +27 -0
  185. package/src/components/namespace-scopes.tsx +44 -0
  186. package/src/components/namespace.ref.test.tsx +139 -0
  187. package/src/components/namespace.test.tsx +52 -0
  188. package/src/components/namespace.tsx +45 -0
  189. package/src/components/parameters/parameters.test.tsx +71 -0
  190. package/src/components/parameters/parameters.tsx +9 -16
  191. package/src/components/property/property.test.tsx +14 -14
  192. package/src/components/property/property.tsx +17 -38
  193. package/src/components/record/declaration.test.tsx +5 -12
  194. package/src/components/record/declaration.tsx +10 -11
  195. package/src/components/struct/declaration.test.tsx +16 -22
  196. package/src/components/struct/declaration.tsx +4 -6
  197. package/src/components/type-parameters/type-parameter.tsx +14 -11
  198. package/src/components/type-parameters/type-parameters.test.tsx +4 -4
  199. package/src/components/var/declaration.test.tsx +8 -14
  200. package/src/components/var/declaration.tsx +12 -6
  201. package/src/contexts/global-namespace.ts +29 -0
  202. package/src/contexts/namespace.ts +13 -0
  203. package/src/index.ts +1 -0
  204. package/src/modifiers.ts +14 -0
  205. package/src/scopes/class.ts +12 -0
  206. package/src/scopes/contexts.ts +45 -0
  207. package/src/scopes/csharp.ts +18 -0
  208. package/src/scopes/factories.ts +45 -0
  209. package/src/scopes/index.ts +9 -0
  210. package/src/scopes/lexical.ts +10 -0
  211. package/src/scopes/method.ts +22 -0
  212. package/src/scopes/named-type.ts +44 -0
  213. package/src/scopes/namespace.ts +59 -0
  214. package/src/scopes/source-file.ts +67 -0
  215. package/src/symbols/csharp.ts +307 -0
  216. package/src/symbols/factories.ts +199 -0
  217. package/src/symbols/index.ts +5 -2
  218. package/src/symbols/method.ts +26 -0
  219. package/src/symbols/named-type.ts +54 -0
  220. package/src/symbols/namespace.ts +62 -0
  221. package/src/symbols/reference.ts +47 -50
  222. package/temp/api.json +6251 -2454
  223. package/test/project-directory.test.tsx +12 -16
  224. package/test/sourcefile.test.tsx +7 -21
  225. package/test/using.test.tsx +18 -16
  226. package/test/utils.tsx +1 -1
  227. package/dist/src/components/EnumDeclaration.d.ts.map +0 -1
  228. package/dist/src/components/EnumDeclaration.js +0 -82
  229. package/dist/src/components/Namespace.d.ts +0 -11
  230. package/dist/src/components/Namespace.d.ts.map +0 -1
  231. package/dist/src/components/Namespace.js +0 -33
  232. package/dist/src/symbols/csharp-output-symbol.d.ts +0 -8
  233. package/dist/src/symbols/csharp-output-symbol.d.ts.map +0 -1
  234. package/dist/src/symbols/csharp-output-symbol.js +0 -19
  235. package/dist/src/symbols/scopes.d.ts +0 -20
  236. package/dist/src/symbols/scopes.d.ts.map +0 -1
  237. package/dist/src/symbols/scopes.js +0 -42
  238. package/dist/test/enum.test.d.ts +0 -2
  239. package/dist/test/enum.test.d.ts.map +0 -1
  240. package/dist/test/enum.test.js +0 -178
  241. package/dist/test/namespace.test.d.ts.map +0 -1
  242. package/dist/test/namespace.test.js +0 -81
  243. package/src/components/EnumDeclaration.tsx +0 -98
  244. package/src/components/Namespace.tsx +0 -35
  245. package/src/symbols/csharp-output-symbol.ts +0 -22
  246. package/src/symbols/scopes.ts +0 -61
  247. package/test/enum.test.tsx +0 -149
  248. package/test/namespace.test.tsx +0 -55
  249. /package/dist/{test → src/components}/namespace.test.d.ts +0 -0
@@ -31,7 +31,7 @@ describe("modifiers", () => {
31
31
  })).toRenderTo(`
32
32
  public class TestClass
33
33
  {
34
- ${accessModifier} string TestProp { get; }
34
+ ${accessModifier} string TestProp { get; }
35
35
  }
36
36
  `);
37
37
  });
@@ -51,7 +51,7 @@ describe("modifiers", () => {
51
51
  })).toRenderTo(`
52
52
  public class TestClass
53
53
  {
54
- ${methodModifier} string TestProp { get; }
54
+ ${methodModifier} string TestProp { get; }
55
55
  }
56
56
  `);
57
57
  });
@@ -70,7 +70,7 @@ describe("modifiers", () => {
70
70
  })).toRenderTo(`
71
71
  public class TestClass
72
72
  {
73
- public new string TestProp { get; }
73
+ public new string TestProp { get; }
74
74
  }
75
75
  `);
76
76
  });
@@ -87,7 +87,7 @@ it("applies PascalCase naming policy", () => {
87
87
  })).toRenderTo(`
88
88
  public class TestClass
89
89
  {
90
- string TestProp { get; }
90
+ string TestProp { get; }
91
91
  }
92
92
  `);
93
93
  });
@@ -103,7 +103,7 @@ it("has getter only", () => {
103
103
  })).toRenderTo(`
104
104
  public class TestClass
105
105
  {
106
- string TestProp { get; }
106
+ string TestProp { get; }
107
107
  }
108
108
  `);
109
109
  });
@@ -119,7 +119,7 @@ it("has setter only", () => {
119
119
  })).toRenderTo(`
120
120
  public class TestClass
121
121
  {
122
- string TestProp { set; }
122
+ string TestProp { set; }
123
123
  }
124
124
  `);
125
125
  });
@@ -136,7 +136,7 @@ it("has getter and setter", () => {
136
136
  })).toRenderTo(`
137
137
  public class TestClass
138
138
  {
139
- string TestProp { get; set; }
139
+ string TestProp { get; set; }
140
140
  }
141
141
  `);
142
142
  });
@@ -153,7 +153,7 @@ it("has getter and init", () => {
153
153
  })).toRenderTo(`
154
154
  public class TestClass
155
155
  {
156
- string TestProp { get; init; }
156
+ string TestProp { get; init; }
157
157
  }
158
158
  `);
159
159
  });
@@ -176,8 +176,8 @@ it("specify doc comment", () => {
176
176
  })).toRenderTo(`
177
177
  class Test
178
178
  {
179
- /// This is a test
180
- string Method { get; set; }
179
+ /// This is a test
180
+ string Method { get; set; }
181
181
  }
182
182
  `);
183
183
  });
@@ -195,7 +195,7 @@ it("specify nullable property", () => {
195
195
  })).toRenderTo(`
196
196
  public class TestClass
197
197
  {
198
- string? TestProp { get; set; }
198
+ string? TestProp { get; set; }
199
199
  }
200
200
  `);
201
201
  });
@@ -213,7 +213,7 @@ it("specify initializer", () => {
213
213
  })).toRenderTo(`
214
214
  public class TestClass
215
215
  {
216
- string TestProp { get; set; } = "abc";
216
+ string TestProp { get; set; } = "abc";
217
217
  }
218
218
  `);
219
219
  });
@@ -235,8 +235,8 @@ it("specify attributes", () => {
235
235
  })).toRenderTo(`
236
236
  public class TestClass
237
237
  {
238
- [Test]
239
- int Test { get; set; }
238
+ [Test]
239
+ int Test { get; set; }
240
240
  }
241
241
  `);
242
242
  });
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/record/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,2DAA2D;AAC3D,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBA6D9D"}
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/record/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,cAAc,EAAc,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,2DAA2D;AAC3D,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBAyD9D"}
@@ -2,8 +2,8 @@ import { createComponent as _$createComponent, createIntrinsic as _$createIntrin
2
2
  import * as core from "@alloy-js/core";
3
3
  import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
4
4
  import { useCSharpNamePolicy } from "../../name-policy.js";
5
- import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
- import { CSharpMemberScope } from "../../symbols/scopes.js";
5
+ import { createClassScope } from "../../scopes/factories.js";
6
+ import { createNamedTypeSymbol, createTypeParameterSymbol } from "../../symbols/factories.js";
7
7
  import { DocWhen } from "../doc/comment.js";
8
8
  import { Name } from "../Name.js";
9
9
  import { Parameters } from "../parameters/parameters.js";
@@ -33,17 +33,13 @@ const getRecordModifiers = makeModifiers(["partial"]);
33
33
  */
34
34
  export function RecordDeclaration(props) {
35
35
  const name = useCSharpNamePolicy().getName(props.name, "record");
36
- const thisRecordSymbol = new CSharpOutputSymbol(name, {
37
- refkeys: props.refkey
38
- });
39
36
 
40
- // this creates a new scope for the record definition.
41
- // members will automatically "inherit" this scope so
42
- // that refkeys to them will produce the fully-qualified
43
- // name e.g. Foo.Bar.
44
- const thisRecordScope = new CSharpMemberScope("record-decl", {
45
- owner: thisRecordSymbol
37
+ // records don't have their own type kind but instead use class or struct
38
+ // depending on what kind of record we have.
39
+ const thisRecordSymbol = createNamedTypeSymbol(name, "record", {
40
+ refkeys: props.refkey
46
41
  });
42
+ const thisRecordScope = createClassScope(thisRecordSymbol);
47
43
  let typeParams;
48
44
  if (props.typeParameters) {
49
45
  const typeParamNames = new Array();
@@ -51,7 +47,7 @@ export function RecordDeclaration(props) {
51
47
  typeParamNames.push(useCSharpNamePolicy().getName(entry[0], "type-parameter"));
52
48
  // create a symbol for each type param so its
53
49
  // refkey resolves to the type param's name
54
- new CSharpOutputSymbol(entry[0], {
50
+ createTypeParameterSymbol(entry[0], {
55
51
  scope: thisRecordScope,
56
52
  refkeys: entry[1]
57
53
  });
@@ -3,18 +3,14 @@ import { code, refkey } from "@alloy-js/core";
3
3
  import { describe, expect, it } from "vitest";
4
4
  import { TestNamespace } from "../../../test/utils.js";
5
5
  import { Property } from "../property/property.js";
6
- import { SourceFile } from "../SourceFile.js";
7
6
  import { RecordDeclaration } from "./declaration.js";
7
+
8
+ // Remove Wrapper that added <SourceFile> because TestNamespace already does
8
9
  function Wrapper({
9
10
  children
10
11
  }) {
11
12
  return _$createComponent(TestNamespace, {
12
- get children() {
13
- return _$createComponent(SourceFile, {
14
- path: "Test.cs",
15
- children: children
16
- });
17
- }
13
+ children: children
18
14
  });
19
15
  }
20
16
  it("declares record with no members", () => {
@@ -102,7 +98,7 @@ it("specify record property inside", () => {
102
98
  /// This is a test
103
99
  record TestRecord
104
100
  {
105
- string Prop { get; set; }
101
+ string Prop { get; set; }
106
102
  }
107
103
  `);
108
104
  });
@@ -136,12 +132,9 @@ describe("constructor", () => {
136
132
  });
137
133
  }
138
134
  })).toRenderTo(`
139
- namespace TestCode
135
+ public record Test(string name, int size)
140
136
  {
141
- public record Test(string name, int size)
142
- {
143
- string PrettyName { get; } = $"{name} {size}";
144
- }
137
+ string PrettyName { get; } = $"{name} {size}";
145
138
  }
146
139
  `);
147
140
  });
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/struct/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAG3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAUD,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,wCAAwC;IACxC,cAAc,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBAwC9D"}
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/struct/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAiB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAG3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAUD,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,eAAe;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CAAC,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC;IAEjD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,wCAAwC;IACxC,cAAc,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,iBAsC9D"}
@@ -3,8 +3,8 @@ import * as core from "@alloy-js/core";
3
3
  import { join } from "@alloy-js/core";
4
4
  import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
5
5
  import { useCSharpNamePolicy } from "../../name-policy.js";
6
- import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
7
- import { CSharpMemberScope } from "../../symbols/scopes.js";
6
+ import { createNamedTypeScope } from "../../scopes/factories.js";
7
+ import { createNamedTypeSymbol } from "../../symbols/factories.js";
8
8
  import { AttributeList } from "../attributes/attributes.js";
9
9
  import { DocWhen } from "../doc/comment.js";
10
10
  import { Name } from "../Name.js";
@@ -36,12 +36,10 @@ const getStructModifiers = makeModifiers(["new", "readonly", "ref", "partial"]);
36
36
  */
37
37
  export function StructDeclaration(props) {
38
38
  const name = useCSharpNamePolicy().getName(props.name, "struct");
39
- const thisStructSymbol = new CSharpOutputSymbol(name, {
39
+ const thisStructSymbol = createNamedTypeSymbol(name, "struct", {
40
40
  refkeys: props.refkey
41
41
  });
42
- const thisStructScope = new CSharpMemberScope("struct-decl", {
43
- owner: thisStructSymbol
44
- });
42
+ const thisStructScope = createNamedTypeScope(thisStructSymbol);
45
43
  const modifiers = computeModifiersPrefix([getAccessModifier(props), getStructModifiers(props)]);
46
44
  const base = props.interfaceTypes && props.interfaceTypes.length > 0 ? [" : ", _$memo(() => join(props.interfaceTypes, {
47
45
  joiner: ", "
@@ -7,7 +7,6 @@ import { Constructor } from "../constructor/constructor.js";
7
7
  import { Field } from "../field/field.js";
8
8
  import { Method } from "../method/method.js";
9
9
  import { Property } from "../property/property.js";
10
- import { SourceFile } from "../SourceFile.js";
11
10
  import { StructDeclaration } from "./declaration.js";
12
11
  it("declares struct with no members", () => {
13
12
  expect(_$createComponent(TestNamespace, {
@@ -85,46 +84,38 @@ describe("with type parameters", () => {
85
84
  }];
86
85
  expect(_$createComponent(TestNamespace, {
87
86
  get children() {
88
- return _$createComponent(SourceFile, {
89
- path: "Test.cs",
87
+ return _$createComponent(StructDeclaration, {
88
+ "public": true,
89
+ name: "Test",
90
+ typeParameters: typeParameters,
90
91
  get children() {
91
- return _$createComponent(StructDeclaration, {
92
- "public": true,
93
- name: "Test",
94
- typeParameters: typeParameters,
92
+ return _$createComponent(List, {
95
93
  get children() {
96
- return _$createComponent(List, {
97
- get children() {
98
- return [_$createComponent(Property, {
99
- name: "PropA",
100
- get type() {
101
- return typeParameters[0].refkey;
102
- },
103
- get: true,
104
- set: true
105
- }), _$createComponent(Property, {
106
- name: "PropB",
107
- get type() {
108
- return typeParameters[1].refkey;
109
- },
110
- get: true,
111
- set: true
112
- })];
113
- }
114
- });
94
+ return [_$createComponent(Property, {
95
+ name: "PropA",
96
+ get type() {
97
+ return typeParameters[0].refkey;
98
+ },
99
+ get: true,
100
+ set: true
101
+ }), _$createComponent(Property, {
102
+ name: "PropB",
103
+ get type() {
104
+ return typeParameters[1].refkey;
105
+ },
106
+ get: true,
107
+ set: true
108
+ })];
115
109
  }
116
110
  });
117
111
  }
118
112
  });
119
113
  }
120
114
  })).toRenderTo(`
121
- namespace TestCode
115
+ public struct Test<T, U>
122
116
  {
123
- public struct Test<T, U>
124
- {
125
- T PropA { get; set; }
126
- U PropB { get; set; }
127
- }
117
+ T PropA { get; set; }
118
+ U PropB { get; set; }
128
119
  }
129
120
  `);
130
121
  });
@@ -147,10 +138,10 @@ describe("with type parameters", () => {
147
138
  }
148
139
  })).toRenderTo(`
149
140
  public struct Test<T, U>
150
- where T : IFoo
151
- where U : IBar
141
+ where T : IFoo
142
+ where U : IBar
152
143
  {
153
- // Body
144
+ // Body
154
145
  }
155
146
  `);
156
147
  });
@@ -187,7 +178,7 @@ it("define methods", () => {
187
178
  })).toRenderTo(`
188
179
  struct Test
189
180
  {
190
- void MethodOne() {}
181
+ void MethodOne() {}
191
182
  }
192
183
  `);
193
184
  });
@@ -206,7 +197,7 @@ it("define constructor", () => {
206
197
  })).toRenderTo(`
207
198
  struct Test
208
199
  {
209
- public Test() {}
200
+ public Test() {}
210
201
  }
211
202
  `);
212
203
  });
@@ -236,8 +227,8 @@ it("defines fields", () => {
236
227
  })).toRenderTo(`
237
228
  public struct TestClass
238
229
  {
239
- public string MemberOne;
240
- public int MemberTwo;
230
+ public string MemberOne;
231
+ public int MemberTwo;
241
232
  }
242
233
  `);
243
234
  });
@@ -1 +1 @@
1
- {"version":3,"file":"type-parameter.d.ts","sourceRoot":"","sources":["../../../../src/components/type-parameters/type-parameter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6B,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,YAStD"}
1
+ {"version":3,"file":"type-parameter.d.ts","sourceRoot":"","sources":["../../../../src/components/type-parameters/type-parameter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGR,MAAM,EACP,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,YAStD"}
@@ -1,22 +1,19 @@
1
1
  import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
- import { MemberDeclaration, refkey } from "@alloy-js/core";
3
- import { useCSharpNamePolicy } from "../../name-policy.js";
4
- import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
5
- import { useCSharpScope } from "../../symbols/scopes.js";
2
+ import { MemberDeclaration, MemberName } from "@alloy-js/core";
3
+ import { createTypeParameterSymbol } from "../../symbols/factories.js";
6
4
 
7
5
  /**
8
6
  * Information for a TypeScript generic type parameter.
9
7
  */
10
8
 
11
9
  export function TypeParameter(props) {
12
- const name = useCSharpNamePolicy().getName(props.name, "type-parameter");
13
- const scope = useCSharpScope();
14
- const symbol = new CSharpOutputSymbol(name, {
15
- scope,
16
- refkeys: props.refkey ?? refkey(props.name)
10
+ const symbol = createTypeParameterSymbol(props.name, {
11
+ refkeys: props.refkey
17
12
  });
18
13
  return _$createComponent(MemberDeclaration, {
19
14
  symbol: symbol,
20
- children: name
15
+ get children() {
16
+ return _$createComponent(MemberName, {});
17
+ }
21
18
  });
22
19
  }
@@ -15,13 +15,13 @@ it("render very long", () => {
15
15
  expect(_$createComponent(TestNamespace, {
16
16
  get children() {
17
17
  return _$createComponent(TypeParameters, {
18
- parameters: ["SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesA", "SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesB"]
18
+ parameters: ["SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesLongLongLongLongLongA", "SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesLongLongLongLongLongB"]
19
19
  });
20
20
  }
21
21
  })).toRenderTo(`
22
22
  <
23
- SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesA,
24
- SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesB>
23
+ SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesLongLongLongLongLongA,
24
+ SomeVeryVeryLongParamThatMightGetSplitOverMultipleLinesLongLongLongLongLongB>
25
25
  `);
26
26
  });
27
27
  it("declare type parameters using parameters names", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/var/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAQ,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI1E,iDAAiD;AACjD,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC1C,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,YAQxD"}
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/var/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAEhB,MAAM,EACP,MAAM,gBAAgB,CAAC;AAGxB,iDAAiD;AACjD,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC1C,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,YASxD"}
@@ -1,7 +1,6 @@
1
1
  import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
- import { Name } from "@alloy-js/core";
3
- import { useCSharpNamePolicy } from "../../name-policy.js";
4
- import { Declaration } from "../Declaration.js";
2
+ import { Declaration, Name } from "@alloy-js/core";
3
+ import { createVariableSymbol } from "../../symbols/factories.js";
5
4
 
6
5
  /** Props for {@link VarDeclaration} component */
7
6
 
@@ -27,12 +26,11 @@ import { Declaration } from "../Declaration.js";
27
26
  * ```
28
27
  */
29
28
  export function VarDeclaration(props) {
30
- const name = useCSharpNamePolicy().getName(props.name, "variable");
29
+ const sym = createVariableSymbol(props.name, {
30
+ refkeys: props.refkey
31
+ });
31
32
  return _$createComponent(Declaration, {
32
- name: name,
33
- get refkey() {
34
- return props.refkey;
35
- },
33
+ symbol: sym,
36
34
  get children() {
37
35
  return [_$memo(() => props.type ?? "var"), " ", _$createComponent(Name, {}), " = ", _$memo(() => props.children), ";"];
38
36
  }
@@ -2,7 +2,6 @@ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime
2
2
  import { List, refkey } from "@alloy-js/core";
3
3
  import { expect, it } from "vitest";
4
4
  import { TestNamespace } from "../../../test/utils.js";
5
- import { SourceFile } from "../SourceFile.js";
6
5
  import { VarDeclaration } from "./declaration.js";
7
6
  it("declares var without type", () => {
8
7
  expect(_$createComponent(TestNamespace, {
@@ -45,29 +44,21 @@ it("links refkey", () => {
45
44
  const key = refkey();
46
45
  expect(_$createComponent(TestNamespace, {
47
46
  get children() {
48
- return _$createComponent(SourceFile, {
49
- path: "test.cs",
47
+ return _$createComponent(List, {
50
48
  get children() {
51
- return _$createComponent(List, {
52
- get children() {
53
- return [_$createComponent(VarDeclaration, {
54
- name: "testVar",
55
- refkey: key,
56
- children: "42"
57
- }), _$createComponent(VarDeclaration, {
58
- name: "testVar2",
59
- children: key
60
- })];
61
- }
62
- });
49
+ return [_$createComponent(VarDeclaration, {
50
+ name: "testVar",
51
+ refkey: key,
52
+ children: "42"
53
+ }), _$createComponent(VarDeclaration, {
54
+ name: "testVar2",
55
+ children: key
56
+ })];
63
57
  }
64
58
  });
65
59
  }
66
60
  })).toRenderTo(`
67
- namespace TestCode
68
- {
69
- var testVar = 42;
70
- var testVar2 = testVar;
71
- }
61
+ var testVar = 42;
62
+ var testVar2 = testVar;
72
63
  `);
73
64
  });
@@ -0,0 +1,5 @@
1
+ import { Binder } from "@alloy-js/core";
2
+ import { NamespaceSymbol } from "../symbols/namespace.js";
3
+ export declare function useGlobalNamespace(): NamespaceSymbol;
4
+ export declare function getGlobalNamespace(binder: Binder | undefined): NamespaceSymbol;
5
+ //# sourceMappingURL=global-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-namespace.d.ts","sourceRoot":"","sources":["../../../src/contexts/global-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,wBAAgB,kBAAkB,oBAGjC;AAMD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,mBAgB5D"}
@@ -0,0 +1,24 @@
1
+ import { useBinder } from "@alloy-js/core";
2
+ import { NamespaceSymbol } from "../symbols/namespace.js";
3
+ export function useGlobalNamespace() {
4
+ const binder = useBinder();
5
+ return getGlobalNamespace(binder);
6
+ }
7
+ const globalNamespaces = new WeakMap();
8
+ const defaultGlobalNamespace = new NamespaceSymbol("global", undefined, {
9
+ isGlobal: true
10
+ });
11
+ export function getGlobalNamespace(binder) {
12
+ if (!binder) {
13
+ return defaultGlobalNamespace;
14
+ }
15
+ let namespace = globalNamespaces.get(binder);
16
+ if (!namespace) {
17
+ namespace = new NamespaceSymbol("global", undefined, {
18
+ binder,
19
+ isGlobal: true
20
+ });
21
+ globalNamespaces.set(binder, namespace);
22
+ }
23
+ return namespace;
24
+ }
@@ -0,0 +1,8 @@
1
+ import { ComponentContext } from "@alloy-js/core";
2
+ import { NamespaceSymbol } from "../symbols/namespace.js";
3
+ export interface NamespaceContext {
4
+ symbol: NamespaceSymbol;
5
+ }
6
+ export declare const NamespaceContext: ComponentContext<NamespaceContext>;
7
+ export declare function useNamespaceContext(): NamespaceContext | undefined;
8
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/contexts/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA6B,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,gBAAgB,CAC/C,CAAC;AAElB,wBAAgB,mBAAmB,iCAElC"}
@@ -0,0 +1,5 @@
1
+ import { createContext, useContext } from "@alloy-js/core";
2
+ export const NamespaceContext = createContext();
3
+ export function useNamespaceContext() {
4
+ return useContext(NamespaceContext);
5
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./components/index.js";
2
2
  export * from "./modifiers.js";
3
3
  export * from "./name-policy.js";
4
+ export * from "./scopes/index.js";
4
5
  export * from "./symbols/index.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./components/index.js";
2
2
  export * from "./modifiers.js";
3
3
  export * from "./name-policy.js";
4
+ export * from "./scopes/index.js";
4
5
  export * from "./symbols/index.js";
@@ -6,6 +6,17 @@ export interface AccessModifiers {
6
6
  readonly internal?: boolean;
7
7
  readonly file?: boolean;
8
8
  }
9
+ export interface NonAccessModifiers {
10
+ readonly override?: boolean;
11
+ readonly abstract?: boolean;
12
+ readonly virtual?: boolean;
13
+ readonly static?: boolean;
14
+ readonly sealed?: boolean;
15
+ readonly extern?: boolean;
16
+ readonly readOnly?: boolean;
17
+ }
18
+ export interface DeclarationModifiers extends AccessModifiers, NonAccessModifiers {
19
+ }
9
20
  export declare const getAccessModifier: (data: AccessModifiers) => string;
10
21
  export declare function getAsyncModifier(async?: boolean): string;
11
22
  /** Resolve the modifier prefix */
@@ -1 +1 @@
1
- {"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../src/modifiers.ts"],"names":[],"mappings":"AAGA,yBAAyB;AACzB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,mCAM5B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAExD;AAED,kCAAkC;AAClC,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GACnC,MAAM,CAGR;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAC1C,MAAM,CAAC,YAMhB"}
1
+ {"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../src/modifiers.ts"],"names":[],"mappings":"AAGA,yBAAyB;AACzB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,oBACf,SAAQ,eAAe,EACrB,kBAAkB;CAAG;AAEzB,eAAO,MAAM,iBAAiB,mCAM5B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAExD;AAED,kCAAkC;AAClC,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GACnC,MAAM,CAGR;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAC1C,MAAM,CAAC,YAMhB"}
@@ -0,0 +1,10 @@
1
+ import type { OutputSpace } from "@alloy-js/core";
2
+ import { CSharpNamedTypeScope } from "./named-type.js";
3
+ export declare class CSharpClassScope extends CSharpNamedTypeScope {
4
+ /**
5
+ * For now, we stuff class parameters into the member scope. This is to ensure
6
+ * name conflicts are handled correctly.
7
+ */
8
+ get parameters(): OutputSpace;
9
+ }
10
+ //# sourceMappingURL=class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../../src/scopes/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,qBAAa,gBAAiB,SAAQ,oBAAoB;IACxD;;;OAGG;IACH,IAAI,UAAU,IAAI,WAAW,CAE5B;CACF"}
@@ -0,0 +1,10 @@
1
+ import { CSharpNamedTypeScope } from "./named-type.js";
2
+ export class CSharpClassScope extends CSharpNamedTypeScope {
3
+ /**
4
+ * For now, we stuff class parameters into the member scope. This is to ensure
5
+ * name conflicts are handled correctly.
6
+ */
7
+ get parameters() {
8
+ return this.members;
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ import { CSharpScope } from "./csharp.js";
2
+ import { CSharpLexicalScope } from "./lexical.js";
3
+ import { CSharpMethodScope } from "./method.js";
4
+ import { CSharpNamedTypeScope } from "./named-type.js";
5
+ export declare function useCSharpScope(): CSharpScope;
6
+ export declare function useNamedTypeScope(): CSharpNamedTypeScope;
7
+ export declare function useMethodScope(): CSharpMethodScope;
8
+ export declare function useLexicalScope(): CSharpLexicalScope;
9
+ //# sourceMappingURL=contexts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/scopes/contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,cAAc,gBAO7B;AAED,wBAAgB,iBAAiB,yBAShC;AAED,wBAAgB,cAAc,sBAQ7B;AAED,wBAAgB,eAAe,uBAQ9B"}