@alloy-js/csharp 0.20.0-dev.1 → 0.20.0-dev.10
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/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +5 -14
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/Name.js +2 -1
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/ProjectDirectory.js +2 -1
- package/dist/src/components/ProjectDirectory.js.map +1 -0
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +7 -2
- package/dist/src/components/Reference.js.map +1 -0
- package/dist/src/components/UsingDirective.d.ts +5 -1
- package/dist/src/components/UsingDirective.d.ts.map +1 -1
- package/dist/src/components/UsingDirective.js +5 -2
- package/dist/src/components/UsingDirective.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.d.ts +54 -0
- package/dist/src/components/access-expression/access-expression.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.js +277 -0
- package/dist/src/components/access-expression/access-expression.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts +2 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.js +336 -0
- package/dist/src/components/access-expression/access-expression.test.js.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts +32 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.js +99 -0
- package/dist/src/components/access-expression/part-descriptors.js.map +1 -0
- package/dist/src/components/attributes/attributes.js +2 -1
- package/dist/src/components/attributes/attributes.js.map +1 -0
- package/dist/src/components/attributes/attributes.test.js +2 -1
- package/dist/src/components/attributes/attributes.test.js.map +1 -0
- package/dist/src/components/class/declaration.d.ts +2 -2
- package/dist/src/components/class/declaration.d.ts.map +1 -1
- package/dist/src/components/class/declaration.js +21 -34
- package/dist/src/components/class/declaration.js.map +1 -0
- package/dist/src/components/class/declaration.test.js +199 -200
- package/dist/src/components/class/declaration.test.js.map +1 -0
- package/dist/src/components/constructor/constructor.d.ts.map +1 -1
- package/dist/src/components/constructor/constructor.js +13 -20
- package/dist/src/components/constructor/constructor.js.map +1 -0
- package/dist/src/components/constructor/constructor.test.js +12 -20
- package/dist/src/components/constructor/constructor.test.js.map +1 -0
- package/dist/src/components/doc/comment.js +2 -1
- package/dist/src/components/doc/comment.js.map +1 -0
- package/dist/src/components/doc/comment.test.js +2 -1
- package/dist/src/components/doc/comment.test.js.map +1 -0
- package/dist/src/components/doc/from-markdown.js +2 -1
- package/dist/src/components/doc/from-markdown.js.map +1 -0
- package/dist/src/components/doc/from-markdown.test.js +2 -1
- package/dist/src/components/doc/from-markdown.test.js.map +1 -0
- package/dist/src/components/{EnumDeclaration.d.ts → enum/declaration.d.ts} +6 -11
- package/dist/src/components/enum/declaration.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.js +55 -0
- package/dist/src/components/enum/declaration.js.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.js +121 -0
- package/dist/src/components/enum/declaration.ref.test.js.map +1 -0
- package/dist/src/components/enum/declaration.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.test.js +40 -0
- package/dist/src/components/enum/declaration.test.js.map +1 -0
- package/dist/src/components/enum/member.d.ts +7 -0
- package/dist/src/components/enum/member.d.ts.map +1 -0
- package/dist/src/components/enum/member.js +30 -0
- package/dist/src/components/enum/member.js.map +1 -0
- package/dist/src/components/enum/member.test.d.ts +2 -0
- package/dist/src/components/enum/member.test.d.ts.map +1 -0
- package/dist/src/components/enum/member.test.js +29 -0
- package/dist/src/components/enum/member.test.js.map +1 -0
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js +11 -18
- package/dist/src/components/field/field.js.map +1 -0
- package/dist/src/components/field/field.test.js +9 -8
- package/dist/src/components/field/field.test.js.map +1 -0
- package/dist/src/components/index.d.ts +7 -3
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -4
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +21 -22
- package/dist/src/components/interface/declaration.js.map +1 -0
- package/dist/src/components/interface/declaration.test.js +28 -36
- package/dist/src/components/interface/declaration.test.js.map +1 -0
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js +9 -19
- package/dist/src/components/interface/method.js.map +1 -0
- package/dist/src/components/interface/method.test.js +40 -48
- package/dist/src/components/interface/method.test.js.map +1 -0
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js +23 -40
- package/dist/src/components/interface/property.js.map +1 -0
- package/dist/src/components/interface/property.test.js +13 -12
- package/dist/src/components/interface/property.test.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts +29 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.js +70 -0
- package/dist/src/components/invocation-expression/invocation-expression.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts +2 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js +105 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js.map +1 -0
- package/dist/src/components/lexical-scope.d.ts +8 -0
- package/dist/src/components/lexical-scope.d.ts.map +1 -0
- package/dist/src/components/lexical-scope.js +25 -0
- package/dist/src/components/lexical-scope.js.map +1 -0
- package/dist/src/components/method/method.d.ts +5 -2
- package/dist/src/components/method/method.d.ts.map +1 -1
- package/dist/src/components/method/method.js +9 -17
- package/dist/src/components/method/method.js.map +1 -0
- package/dist/src/components/method/method.test.js +13 -12
- package/dist/src/components/method/method.test.js.map +1 -0
- package/dist/src/components/method-scope.d.ts +8 -0
- package/dist/src/components/method-scope.d.ts.map +1 -0
- package/dist/src/components/method-scope.js +25 -0
- package/dist/src/components/method-scope.js.map +1 -0
- package/dist/src/components/namespace-scopes.d.ts +13 -0
- package/dist/src/components/namespace-scopes.d.ts.map +1 -0
- package/dist/src/components/namespace-scopes.js +45 -0
- package/dist/src/components/namespace-scopes.js.map +1 -0
- package/dist/src/components/namespace.d.ts +7 -0
- package/dist/src/components/namespace.d.ts.map +1 -0
- package/dist/src/components/namespace.js +47 -0
- package/dist/src/components/namespace.js.map +1 -0
- package/dist/src/components/namespace.ref.test.d.ts +2 -0
- package/dist/src/components/namespace.ref.test.d.ts.map +1 -0
- package/dist/src/components/namespace.ref.test.js +182 -0
- package/dist/src/components/namespace.ref.test.js.map +1 -0
- package/dist/src/components/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace.test.js +79 -0
- package/dist/src/components/namespace.test.js.map +1 -0
- package/dist/src/components/parameters/parameters.d.ts +2 -3
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +15 -15
- package/dist/src/components/parameters/parameters.js.map +1 -0
- package/dist/src/components/parameters/parameters.test.d.ts +2 -0
- package/dist/src/components/parameters/parameters.test.d.ts.map +1 -0
- package/dist/src/components/parameters/parameters.test.js +154 -0
- package/dist/src/components/parameters/parameters.test.js.map +1 -0
- package/dist/src/components/property/property.d.ts +2 -2
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +30 -40
- package/dist/src/components/property/property.js.map +1 -0
- package/dist/src/components/property/property.test.js +16 -15
- package/dist/src/components/property/property.test.js.map +1 -0
- package/dist/src/components/record/declaration.d.ts +18 -0
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +21 -14
- package/dist/src/components/record/declaration.js.map +1 -0
- package/dist/src/components/record/declaration.test.js +52 -4
- package/dist/src/components/record/declaration.test.js.map +1 -0
- package/dist/src/components/source-file/source-file.d.ts +19 -0
- package/dist/src/components/source-file/source-file.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.js +59 -0
- package/dist/src/components/source-file/source-file.js.map +1 -0
- package/dist/src/components/source-file/source-file.test.d.ts +2 -0
- package/dist/src/components/source-file/source-file.test.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.test.js +136 -0
- package/dist/src/components/source-file/source-file.test.js.map +1 -0
- package/dist/src/components/stc/index.js +2 -1
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +6 -7
- package/dist/src/components/struct/declaration.js.map +1 -0
- package/dist/src/components/struct/declaration.test.js +32 -40
- package/dist/src/components/struct/declaration.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js +9 -11
- package/dist/src/components/type-parameters/type-parameter.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.js +2 -1
- package/dist/src/components/type-parameters/type-parameters.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.test.js +5 -4
- package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -0
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +8 -9
- package/dist/src/components/var/declaration.js.map +1 -0
- package/dist/src/components/var/declaration.test.js +13 -21
- package/dist/src/components/var/declaration.test.js.map +1 -0
- package/dist/src/contexts/format-options.d.ts +5 -0
- package/dist/src/contexts/format-options.d.ts.map +1 -0
- package/dist/src/contexts/format-options.js +9 -0
- package/dist/src/contexts/format-options.js.map +1 -0
- package/dist/src/contexts/global-namespace.d.ts +5 -0
- package/dist/src/contexts/global-namespace.d.ts.map +1 -0
- package/dist/src/contexts/global-namespace.js +25 -0
- package/dist/src/contexts/global-namespace.js.map +1 -0
- package/dist/src/contexts/namespace.d.ts +8 -0
- package/dist/src/contexts/namespace.d.ts.map +1 -0
- package/dist/src/contexts/namespace.js +6 -0
- package/dist/src/contexts/namespace.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/modifiers.d.ts +11 -0
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +2 -1
- package/dist/src/modifiers.js.map +1 -0
- package/dist/src/name-policy.js +2 -1
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/scopes/class.d.ts +10 -0
- package/dist/src/scopes/class.d.ts.map +1 -0
- package/dist/src/scopes/class.js +11 -0
- package/dist/src/scopes/class.js.map +1 -0
- package/dist/src/scopes/contexts.d.ts +9 -0
- package/dist/src/scopes/contexts.d.ts.map +1 -0
- package/dist/src/scopes/contexts.js +34 -0
- package/dist/src/scopes/contexts.js.map +1 -0
- package/dist/src/scopes/csharp.d.ts +10 -0
- package/dist/src/scopes/csharp.d.ts.map +1 -0
- package/dist/src/scopes/csharp.js +15 -0
- package/dist/src/scopes/csharp.js.map +1 -0
- package/dist/src/scopes/factories.d.ts +9 -0
- package/dist/src/scopes/factories.d.ts.map +1 -0
- package/dist/src/scopes/factories.js +24 -0
- package/dist/src/scopes/factories.js.map +1 -0
- package/dist/src/scopes/index.d.ts +10 -0
- package/dist/src/scopes/index.d.ts.map +1 -0
- package/dist/src/scopes/index.js +10 -0
- package/dist/src/scopes/index.js.map +1 -0
- package/dist/src/scopes/lexical.d.ts +7 -0
- package/dist/src/scopes/lexical.d.ts.map +1 -0
- package/dist/src/scopes/lexical.js +8 -0
- package/dist/src/scopes/lexical.js.map +1 -0
- package/dist/src/scopes/method.d.ts +9 -0
- package/dist/src/scopes/method.d.ts.map +1 -0
- package/dist/src/scopes/method.js +14 -0
- package/dist/src/scopes/method.js.map +1 -0
- package/dist/src/scopes/named-type.d.ts +22 -0
- package/dist/src/scopes/named-type.d.ts.map +1 -0
- package/dist/src/scopes/named-type.js +33 -0
- package/dist/src/scopes/named-type.js.map +1 -0
- package/dist/src/scopes/namespace.d.ts +11 -0
- package/dist/src/scopes/namespace.d.ts.map +1 -0
- package/dist/src/scopes/namespace.js +39 -0
- package/dist/src/scopes/namespace.js.map +1 -0
- package/dist/src/scopes/source-file.d.ts +16 -0
- package/dist/src/scopes/source-file.d.ts.map +1 -0
- package/dist/src/scopes/source-file.js +44 -0
- package/dist/src/scopes/source-file.js.map +1 -0
- package/dist/src/symbols/csharp.d.ts +87 -0
- package/dist/src/symbols/csharp.d.ts.map +1 -0
- package/dist/src/symbols/csharp.js +246 -0
- package/dist/src/symbols/csharp.js.map +1 -0
- package/dist/src/symbols/factories.d.ts +25 -0
- package/dist/src/symbols/factories.d.ts.map +1 -0
- package/dist/src/symbols/factories.js +93 -0
- package/dist/src/symbols/factories.js.map +1 -0
- package/dist/src/symbols/index.d.ts +5 -2
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +6 -2
- package/dist/src/symbols/index.js.map +1 -0
- package/dist/src/symbols/method.d.ts +13 -0
- package/dist/src/symbols/method.d.ts.map +1 -0
- package/dist/src/symbols/method.js +16 -0
- package/dist/src/symbols/method.js.map +1 -0
- package/dist/src/symbols/named-type.d.ts +19 -0
- package/dist/src/symbols/named-type.d.ts.map +1 -0
- package/dist/src/symbols/named-type.js +31 -0
- package/dist/src/symbols/named-type.js.map +1 -0
- package/dist/src/symbols/namespace.d.ts +22 -0
- package/dist/src/symbols/namespace.d.ts.map +1 -0
- package/dist/src/symbols/namespace.js +45 -0
- package/dist/src/symbols/namespace.js.map +1 -0
- package/dist/src/symbols/reference.d.ts +2 -2
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +50 -44
- package/dist/src/symbols/reference.js.map +1 -0
- package/dist/test/project-directory.test.js +20 -19
- package/dist/test/project-directory.test.js.map +1 -0
- package/dist/test/using.test.js +23 -21
- package/dist/test/using.test.js.map +1 -0
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +7 -4
- package/dist/test/utils.js.map +1 -0
- package/dist/test/vitest.setup.js +2 -1
- package/dist/test/vitest.setup.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/components/Declaration.tsx +3 -6
- package/src/components/Reference.tsx +3 -1
- package/src/components/UsingDirective.tsx +12 -2
- package/src/components/access-expression/access-expression.test.tsx +284 -0
- package/src/components/access-expression/access-expression.tsx +375 -0
- package/src/components/access-expression/part-descriptors.ts +175 -0
- package/src/components/class/declaration.test.tsx +142 -150
- package/src/components/class/declaration.tsx +20 -32
- package/src/components/constructor/constructor.test.tsx +10 -16
- package/src/components/constructor/constructor.tsx +13 -32
- package/src/components/enum/declaration.ref.test.tsx +93 -0
- package/src/components/enum/declaration.test.tsx +34 -0
- package/src/components/enum/declaration.tsx +65 -0
- package/src/components/enum/member.test.tsx +24 -0
- package/src/components/enum/member.tsx +36 -0
- package/src/components/field/field.test.tsx +7 -7
- package/src/components/field/field.tsx +12 -22
- package/src/components/index.ts +7 -3
- package/src/components/interface/declaration.test.tsx +26 -32
- package/src/components/interface/declaration.tsx +16 -18
- package/src/components/interface/method.test.tsx +38 -44
- package/src/components/interface/method.tsx +7 -20
- package/src/components/interface/property.test.tsx +11 -11
- package/src/components/interface/property.tsx +15 -34
- package/src/components/invocation-expression/invocation-expression.test.tsx +101 -0
- package/src/components/invocation-expression/invocation-expression.tsx +60 -0
- package/src/components/lexical-scope.tsx +29 -0
- package/src/components/method/method.test.tsx +11 -11
- package/src/components/method/method.tsx +12 -23
- package/src/components/method-scope.tsx +27 -0
- package/src/components/namespace-scopes.tsx +44 -0
- package/src/components/namespace.ref.test.tsx +139 -0
- package/src/components/namespace.test.tsx +52 -0
- package/src/components/namespace.tsx +45 -0
- package/src/components/parameters/parameters.test.tsx +117 -0
- package/src/components/parameters/parameters.tsx +11 -23
- package/src/components/property/property.test.tsx +14 -14
- package/src/components/property/property.tsx +23 -41
- package/src/components/record/declaration.test.tsx +47 -3
- package/src/components/record/declaration.tsx +34 -11
- package/src/components/source-file/source-file.test.tsx +96 -0
- package/src/components/source-file/source-file.tsx +98 -0
- package/src/components/struct/declaration.test.tsx +16 -22
- package/src/components/struct/declaration.tsx +4 -6
- package/src/components/type-parameters/type-parameter.tsx +14 -11
- package/src/components/type-parameters/type-parameters.test.tsx +4 -4
- package/src/components/var/declaration.test.tsx +8 -14
- package/src/components/var/declaration.tsx +12 -6
- package/src/contexts/format-options.ts +14 -0
- package/src/contexts/global-namespace.ts +29 -0
- package/src/contexts/namespace.ts +13 -0
- package/src/index.ts +2 -0
- package/src/modifiers.ts +14 -0
- package/src/scopes/class.ts +12 -0
- package/src/scopes/contexts.ts +45 -0
- package/src/scopes/csharp.ts +23 -0
- package/src/scopes/factories.ts +45 -0
- package/src/scopes/index.ts +9 -0
- package/src/scopes/lexical.ts +10 -0
- package/src/scopes/method.ts +22 -0
- package/src/scopes/named-type.ts +44 -0
- package/src/scopes/namespace.ts +59 -0
- package/src/scopes/source-file.ts +67 -0
- package/src/symbols/csharp.ts +339 -0
- package/src/symbols/factories.ts +215 -0
- package/src/symbols/index.ts +5 -2
- package/src/symbols/method.ts +26 -0
- package/src/symbols/named-type.ts +54 -0
- package/src/symbols/namespace.ts +62 -0
- package/src/symbols/reference.tsx +64 -0
- package/temp/api.json +6919 -2532
- package/test/project-directory.test.tsx +14 -16
- package/test/using.test.tsx +21 -21
- package/test/utils.tsx +2 -1
- package/tsconfig.json +4 -1
- package/tsdoc-metadata.json +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +0 -1
- package/dist/src/components/EnumDeclaration.js +0 -85
- package/dist/src/components/Namespace.d.ts +0 -11
- package/dist/src/components/Namespace.d.ts.map +0 -1
- package/dist/src/components/Namespace.js +0 -33
- package/dist/src/components/SourceFile.d.ts +0 -14
- package/dist/src/components/SourceFile.d.ts.map +0 -1
- package/dist/src/components/SourceFile.js +0 -69
- package/dist/src/symbols/csharp-output-symbol.d.ts +0 -8
- package/dist/src/symbols/csharp-output-symbol.d.ts.map +0 -1
- package/dist/src/symbols/csharp-output-symbol.js +0 -19
- package/dist/src/symbols/scopes.d.ts +0 -14
- package/dist/src/symbols/scopes.d.ts.map +0 -1
- package/dist/src/symbols/scopes.js +0 -31
- package/dist/test/enum.test.d.ts +0 -2
- package/dist/test/enum.test.d.ts.map +0 -1
- package/dist/test/enum.test.js +0 -178
- package/dist/test/namespace.test.d.ts.map +0 -1
- package/dist/test/namespace.test.js +0 -81
- package/dist/test/sourcefile.test.d.ts +0 -2
- package/dist/test/sourcefile.test.d.ts.map +0 -1
- package/dist/test/sourcefile.test.js +0 -58
- package/src/components/EnumDeclaration.tsx +0 -99
- package/src/components/Namespace.tsx +0 -35
- package/src/components/SourceFile.tsx +0 -78
- package/src/symbols/csharp-output-symbol.ts +0 -22
- package/src/symbols/reference.ts +0 -65
- package/src/symbols/scopes.ts +0 -41
- package/test/enum.test.tsx +0 -149
- package/test/namespace.test.tsx +0 -55
- package/test/sourcefile.test.tsx +0 -47
- /package/dist/{test → src/components}/namespace.test.d.ts +0 -0
|
@@ -22,6 +22,7 @@ it("defines a project directory file with multiple source files", () => {
|
|
|
22
22
|
</csharp.Namespace>
|
|
23
23
|
</csharp.ProjectDirectory>
|
|
24
24
|
</core.Output>,
|
|
25
|
+
{ insertFinalNewLine: false },
|
|
25
26
|
);
|
|
26
27
|
|
|
27
28
|
const projDir = res.contents[0] as core.OutputDirectory;
|
|
@@ -46,19 +47,17 @@ it("defines a project directory file with multiple source files", () => {
|
|
|
46
47
|
expect(srcDir.contents[0].path).equals("~/projects/TestProject/src/Test1.cs");
|
|
47
48
|
expect((srcDir.contents[0] as core.ContentOutputFile).contents)
|
|
48
49
|
.toBe(coretest.d`
|
|
49
|
-
namespace TestCode
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
50
|
+
namespace TestCode;
|
|
51
|
+
|
|
52
|
+
public class TestClass1;
|
|
53
53
|
`);
|
|
54
54
|
|
|
55
55
|
expect(srcDir.contents[1].path).equals("~/projects/TestProject/src/Test2.cs");
|
|
56
56
|
expect((srcDir.contents[1] as core.ContentOutputFile).contents)
|
|
57
57
|
.toBe(coretest.d`
|
|
58
|
-
namespace TestCode
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
58
|
+
namespace TestCode;
|
|
59
|
+
|
|
60
|
+
public class TestClass2;
|
|
62
61
|
`);
|
|
63
62
|
});
|
|
64
63
|
|
|
@@ -82,6 +81,7 @@ it("defines a project directory file with multiple source files and a custom TFM
|
|
|
82
81
|
</csharp.Namespace>
|
|
83
82
|
</csharp.ProjectDirectory>
|
|
84
83
|
</core.Output>,
|
|
84
|
+
{ insertFinalNewLine: false },
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const projDir = res.contents[0] as core.OutputDirectory;
|
|
@@ -106,18 +106,16 @@ it("defines a project directory file with multiple source files and a custom TFM
|
|
|
106
106
|
expect(srcDir.contents[0].path).equals("~/projects/TestProject/src/Test1.cs");
|
|
107
107
|
expect((srcDir.contents[0] as core.ContentOutputFile).contents)
|
|
108
108
|
.toBe(coretest.d`
|
|
109
|
-
namespace TestCode
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
109
|
+
namespace TestCode;
|
|
110
|
+
|
|
111
|
+
public class TestClass1;
|
|
113
112
|
`);
|
|
114
113
|
|
|
115
114
|
expect(srcDir.contents[1].path).equals("~/projects/TestProject/src/Test2.cs");
|
|
116
115
|
expect((srcDir.contents[1] as core.ContentOutputFile).contents)
|
|
117
116
|
.toBe(coretest.d`
|
|
118
|
-
namespace TestCode
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
117
|
+
namespace TestCode;
|
|
118
|
+
|
|
119
|
+
public class TestClass2;
|
|
122
120
|
`);
|
|
123
121
|
});
|
package/test/using.test.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import * as core from "@alloy-js/core";
|
|
|
2
2
|
import * as coretest from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import * as csharp from "../src/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { findFile } from "./utils.jsx";
|
|
6
6
|
|
|
7
7
|
it("uses a single namespace", () => {
|
|
8
8
|
const res = core.render(
|
|
@@ -16,7 +16,9 @@ it("uses a single namespace", () => {
|
|
|
16
16
|
expect(findFile(res, "Test1.cs").contents).toBe(coretest.d`
|
|
17
17
|
using Foo;
|
|
18
18
|
|
|
19
|
-
namespace TestCode
|
|
19
|
+
namespace TestCode;
|
|
20
|
+
|
|
21
|
+
|
|
20
22
|
`);
|
|
21
23
|
});
|
|
22
24
|
|
|
@@ -33,7 +35,9 @@ it("uses multiple namespaces", () => {
|
|
|
33
35
|
using Bar.Baz;
|
|
34
36
|
using Foo;
|
|
35
37
|
|
|
36
|
-
namespace TestCode
|
|
38
|
+
namespace TestCode;
|
|
39
|
+
|
|
40
|
+
|
|
37
41
|
`);
|
|
38
42
|
});
|
|
39
43
|
|
|
@@ -49,7 +53,7 @@ it("adds using statement across namespaces", () => {
|
|
|
49
53
|
},
|
|
50
54
|
];
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
expect(
|
|
53
57
|
<core.Output namePolicy={csharp.createCSharpNamePolicy()}>
|
|
54
58
|
<csharp.Namespace name="Models">
|
|
55
59
|
<csharp.SourceFile path="Models.cs">
|
|
@@ -86,33 +90,29 @@ it("adds using statement across namespaces", () => {
|
|
|
86
90
|
</csharp.SourceFile>
|
|
87
91
|
</csharp.Namespace>
|
|
88
92
|
</core.Output>,
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
assertFileContents(res, {
|
|
93
|
+
).toRenderTo({
|
|
92
94
|
"Models.cs": coretest.d`
|
|
93
|
-
namespace Models
|
|
95
|
+
namespace Models;
|
|
96
|
+
|
|
97
|
+
public class Input;
|
|
98
|
+
public class Output;
|
|
99
|
+
public enum TestEnum
|
|
94
100
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
public enum TestEnum
|
|
98
|
-
{
|
|
99
|
-
One,
|
|
100
|
-
Two
|
|
101
|
-
}
|
|
101
|
+
One,
|
|
102
|
+
Two
|
|
102
103
|
}
|
|
103
104
|
`,
|
|
104
105
|
"Client.cs": coretest.d`
|
|
105
106
|
using Models;
|
|
106
107
|
using System;
|
|
107
108
|
|
|
108
|
-
namespace Client
|
|
109
|
+
namespace Client;
|
|
110
|
+
|
|
111
|
+
public class Client
|
|
109
112
|
{
|
|
110
|
-
public
|
|
111
|
-
{
|
|
112
|
-
public Output MethodOne(Input bodyParam) {}
|
|
113
|
-
}
|
|
114
|
-
TestEnum.Two;
|
|
113
|
+
public Output MethodOne(Input bodyParam) {}
|
|
115
114
|
}
|
|
115
|
+
TestEnum.Two;
|
|
116
116
|
`,
|
|
117
117
|
});
|
|
118
118
|
});
|
package/test/utils.tsx
CHANGED
|
@@ -8,7 +8,7 @@ export function TestNamespace(props: {
|
|
|
8
8
|
}): core.Children {
|
|
9
9
|
return (
|
|
10
10
|
<core.Output namePolicy={csharp.createCSharpNamePolicy()}>
|
|
11
|
-
<csharp.
|
|
11
|
+
<csharp.SourceFile path="Test.cs">{props.children}</csharp.SourceFile>
|
|
12
12
|
</core.Output>
|
|
13
13
|
);
|
|
14
14
|
}
|
|
@@ -19,6 +19,7 @@ export function toSourceText(c: core.Children): string {
|
|
|
19
19
|
<csharp.SourceFile path="Test.cs">{c}</csharp.SourceFile>
|
|
20
20
|
</csharp.Namespace>
|
|
21
21
|
</core.Output>,
|
|
22
|
+
{ insertFinalNewLine: false },
|
|
22
23
|
);
|
|
23
24
|
|
|
24
25
|
const file = findFile(res, "Test.cs");
|
package/tsconfig.json
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
"emitDeclarationOnly": true,
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"outDir": "dist",
|
|
7
|
-
"types": ["@alloy-js/core/testing/matchers"]
|
|
7
|
+
"types": ["@alloy-js/core/testing/matchers"],
|
|
8
|
+
"paths": {
|
|
9
|
+
"#components/*": ["./src/components/*"]
|
|
10
|
+
}
|
|
8
11
|
},
|
|
9
12
|
"references": [{ "path": "../core" }],
|
|
10
13
|
"include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
|
package/tsdoc-metadata.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnumDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/EnumDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,iBAgC1D;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAmBhD"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as core from "@alloy-js/core";
|
|
3
|
-
import { computeModifiersPrefix, getAccessModifier } from "../modifiers.js";
|
|
4
|
-
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
5
|
-
import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
|
|
6
|
-
import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
|
|
7
|
-
import { Name } from "./Name.js";
|
|
8
|
-
|
|
9
|
-
// properties for creating an enum
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A C# enum declaration
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* <EnumDeclaration public name="Color">
|
|
16
|
-
* <EnumMember name="Red" />
|
|
17
|
-
* <EnumMember name="Green" />
|
|
18
|
-
* <EnumMember name="Blue" />
|
|
19
|
-
* </EnumDeclaration>
|
|
20
|
-
* ```
|
|
21
|
-
* This will produce:
|
|
22
|
-
* ```csharp
|
|
23
|
-
* public enum Color
|
|
24
|
-
* {
|
|
25
|
-
* Red,
|
|
26
|
-
* Green,
|
|
27
|
-
* Blue
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export function EnumDeclaration(props) {
|
|
32
|
-
const name = useCSharpNamePolicy().getName(props.name, "enum");
|
|
33
|
-
const scope = useCSharpScope();
|
|
34
|
-
const thisEnumSymbol = new CSharpOutputSymbol(name, {
|
|
35
|
-
scope,
|
|
36
|
-
refkeys: props.refkey ?? core.refkey(props.name)
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// this creates a new scope for the enum definition.
|
|
40
|
-
// members will automatically "inherit" this scope so
|
|
41
|
-
// that refkeys to them will produce the fully-qualified
|
|
42
|
-
// name e.g. Foo.Bar.
|
|
43
|
-
const thisEnumScope = new CSharpMemberScope("enum-decl", {
|
|
44
|
-
parent: scope,
|
|
45
|
-
owner: thisEnumSymbol
|
|
46
|
-
});
|
|
47
|
-
const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
|
|
48
|
-
if (thisEnumScope.owner) return _$createComponent(core.Declaration, {
|
|
49
|
-
symbol: thisEnumSymbol,
|
|
50
|
-
get children() {
|
|
51
|
-
return [modifiers, "enum ", _$createComponent(Name, {}), _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && _$createComponent(core.Scope, {
|
|
52
|
-
value: thisEnumScope,
|
|
53
|
-
get children() {
|
|
54
|
-
return _$createComponent(core.Block, {
|
|
55
|
-
newline: true,
|
|
56
|
-
get children() {
|
|
57
|
-
return props.children;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}))];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// properties for creating a C# enum member
|
|
67
|
-
|
|
68
|
-
// a member within a C# enum
|
|
69
|
-
export function EnumMember(props) {
|
|
70
|
-
const scope = useCSharpScope();
|
|
71
|
-
if (scope.kind === "member" && scope.name !== "enum-decl") {
|
|
72
|
-
throw new Error("can't define an enum member outside of an enum-decl scope");
|
|
73
|
-
}
|
|
74
|
-
const name = useCSharpNamePolicy().getName(props.name, "enum-member");
|
|
75
|
-
const thisEnumValueSymbol = new CSharpOutputSymbol(name, {
|
|
76
|
-
scope,
|
|
77
|
-
refkeys: props.refkey ?? core.refkey(props.name)
|
|
78
|
-
});
|
|
79
|
-
return _$createComponent(core.Declaration, {
|
|
80
|
-
symbol: thisEnumValueSymbol,
|
|
81
|
-
get children() {
|
|
82
|
-
return _$createComponent(Name, {});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
export interface NamespaceContext {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function useNamespace(): NamespaceContext | undefined;
|
|
6
|
-
export interface NamespaceProps {
|
|
7
|
-
name: string;
|
|
8
|
-
children?: core.Children;
|
|
9
|
-
}
|
|
10
|
-
export declare function Namespace(props: NamespaceProps): core.Children;
|
|
11
|
-
//# sourceMappingURL=Namespace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Namespace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,wBAAgB,YAAY,IAAI,gBAAgB,GAAG,SAAS,CAE3D;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iBAY9C"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as core from "@alloy-js/core";
|
|
3
|
-
import { CSharpNamespaceScope } from "../symbols/scopes.js";
|
|
4
|
-
|
|
5
|
-
// contains the info for the current namespace
|
|
6
|
-
|
|
7
|
-
const NamespaceContext = core.createContext();
|
|
8
|
-
|
|
9
|
-
// returns the current namespace
|
|
10
|
-
export function useNamespace() {
|
|
11
|
-
return core.useContext(NamespaceContext);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// properties for creating a C# namespace
|
|
15
|
-
|
|
16
|
-
// a C# namespace. contains one or more source files
|
|
17
|
-
export function Namespace(props) {
|
|
18
|
-
const scope = new CSharpNamespaceScope(props.name);
|
|
19
|
-
const namespaceCtx = {
|
|
20
|
-
name: props.name
|
|
21
|
-
};
|
|
22
|
-
return _$createComponent(NamespaceContext.Provider, {
|
|
23
|
-
value: namespaceCtx,
|
|
24
|
-
get children() {
|
|
25
|
-
return _$createComponent(core.Scope, {
|
|
26
|
-
value: scope,
|
|
27
|
-
get children() {
|
|
28
|
-
return props.children;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
export interface SourceFileContext {
|
|
3
|
-
addUsing(namespace: string): void;
|
|
4
|
-
}
|
|
5
|
-
export declare function useSourceFile(): SourceFileContext | undefined;
|
|
6
|
-
export interface SourceFileProps {
|
|
7
|
-
/** Path of the source file */
|
|
8
|
-
path: string;
|
|
9
|
-
/** A list of namespaces to use */
|
|
10
|
-
using?: Array<string>;
|
|
11
|
-
children?: core.Children;
|
|
12
|
-
}
|
|
13
|
-
export declare function SourceFile(props: SourceFileProps): core.Children;
|
|
14
|
-
//# sourceMappingURL=SourceFile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAMvC,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAKD,wBAAgB,aAAa,IAAI,iBAAiB,GAAG,SAAS,CAE7D;AAED,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEtB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBA+ChD"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as core from "@alloy-js/core";
|
|
3
|
-
import { useNamespace } from "./Namespace.js";
|
|
4
|
-
import { Reference } from "./Reference.js";
|
|
5
|
-
import { UsingDirective } from "./UsingDirective.js";
|
|
6
|
-
|
|
7
|
-
// contains the info for the current source file
|
|
8
|
-
|
|
9
|
-
const SourceFileContext = core.createContext();
|
|
10
|
-
|
|
11
|
-
// returns the current source file
|
|
12
|
-
export function useSourceFile() {
|
|
13
|
-
return core.useContext(SourceFileContext);
|
|
14
|
-
}
|
|
15
|
-
// a C# source file. exists within the context of a namespace
|
|
16
|
-
// contains using statements and declarations
|
|
17
|
-
export function SourceFile(props) {
|
|
18
|
-
const namespaceCtx = useNamespace();
|
|
19
|
-
if (!namespaceCtx) {
|
|
20
|
-
throw new Error("SourceFile must be declared inside a namespace");
|
|
21
|
-
}
|
|
22
|
-
const using = core.reactive(new Array());
|
|
23
|
-
if (props.using) {
|
|
24
|
-
using.push(...props.using);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// adds the specified namespace to the array of using statements.
|
|
28
|
-
// called via SourceFileContext.addUsing when resolving refkeys.
|
|
29
|
-
function addUsing(namespace) {
|
|
30
|
-
if (!using.includes(namespace)) {
|
|
31
|
-
using.push(namespace);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const sourceFileCtx = {
|
|
35
|
-
addUsing
|
|
36
|
-
};
|
|
37
|
-
return _$createComponent(core.SourceFile, {
|
|
38
|
-
get path() {
|
|
39
|
-
return props.path;
|
|
40
|
-
},
|
|
41
|
-
filetype: "cs",
|
|
42
|
-
reference: Reference,
|
|
43
|
-
tabWidth: 4,
|
|
44
|
-
printWidth: 120,
|
|
45
|
-
get children() {
|
|
46
|
-
return _$createComponent(SourceFileContext.Provider, {
|
|
47
|
-
value: sourceFileCtx,
|
|
48
|
-
get children() {
|
|
49
|
-
return _$createComponent(core.Scope, {
|
|
50
|
-
get name() {
|
|
51
|
-
return props.path;
|
|
52
|
-
},
|
|
53
|
-
kind: "source-file",
|
|
54
|
-
get children() {
|
|
55
|
-
return [_$memo(() => _$memo(() => using.length > 0)() && [_$createComponent(UsingDirective, {
|
|
56
|
-
namespaces: using
|
|
57
|
-
}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {})]), "namespace ", _$memo(() => namespaceCtx.name), _$createComponent(core.Block, {
|
|
58
|
-
newline: true,
|
|
59
|
-
get children() {
|
|
60
|
-
return props.children;
|
|
61
|
-
}
|
|
62
|
-
})];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { CSharpOutputScope } from "./scopes.js";
|
|
3
|
-
export declare class CSharpOutputSymbol extends core.OutputSymbol {
|
|
4
|
-
get scope(): CSharpOutputScope;
|
|
5
|
-
set scope(value: CSharpOutputScope);
|
|
6
|
-
constructor(name: string, options?: core.OutputSymbolOptions);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=csharp-output-symbol.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csharp-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/csharp-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD,qBAAa,kBAAmB,SAAQ,IAAI,CAAC,YAAY;IACvD,IAAI,KAAK,IAGQ,iBAAiB,CADjC;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,iBAAiB,EAEjC;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB;CAO7D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { useNamespace } from "../components/Namespace.js";
|
|
3
|
-
// represents a symbol from a .cs file. Class, enum, interface etc.
|
|
4
|
-
|
|
5
|
-
export class CSharpOutputSymbol extends core.OutputSymbol {
|
|
6
|
-
get scope() {
|
|
7
|
-
return super.scope;
|
|
8
|
-
}
|
|
9
|
-
set scope(value) {
|
|
10
|
-
super.scope = value;
|
|
11
|
-
}
|
|
12
|
-
constructor(name, options) {
|
|
13
|
-
const namespaceCtx = useNamespace();
|
|
14
|
-
if (!namespaceCtx) {
|
|
15
|
-
throw new Error("symbol must be declared inside a namespace");
|
|
16
|
-
}
|
|
17
|
-
super(name, options);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { CSharpOutputSymbol } from "./csharp-output-symbol.js";
|
|
3
|
-
export declare class CSharpNamespaceScope extends core.OutputScope {
|
|
4
|
-
get kind(): string;
|
|
5
|
-
}
|
|
6
|
-
export type CSharpMemberScopeName = "class-decl" | "constructor-decl" | "enum-decl" | "method-decl";
|
|
7
|
-
export declare class CSharpMemberScope extends core.OutputScope {
|
|
8
|
-
get kind(): string;
|
|
9
|
-
get name(): CSharpMemberScopeName;
|
|
10
|
-
get owner(): CSharpOutputSymbol;
|
|
11
|
-
}
|
|
12
|
-
export type CSharpOutputScope = CSharpMemberScope | CSharpNamespaceScope;
|
|
13
|
-
export declare function useCSharpScope(): CSharpOutputScope;
|
|
14
|
-
//# sourceMappingURL=scopes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/symbols/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,qBAAa,oBAAqB,SAAQ,IAAI,CAAC,WAAW;IACxD,IAAI,IAAI,WAEP;CACF;AAGD,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,kBAAkB,GAClB,WAAW,GACX,aAAa,CAAC;AAKlB,qBAAa,iBAAkB,SAAQ,IAAI,CAAC,WAAW;IACrD,IAAI,IAAI,WAEP;IAED,IAAI,IAAI,IACe,qBAAqB,CAC3C;IAED,IAAI,KAAK,IACe,kBAAkB,CACzC;CACF;AAGD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAGzE,wBAAgB,cAAc,IAAI,iBAAiB,CAElD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
// indicates that the scope for a symbols is at the namespace level
|
|
3
|
-
export class CSharpNamespaceScope extends core.OutputScope {
|
|
4
|
-
get kind() {
|
|
5
|
-
return "namespace";
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// the kind of member scope. i.e. are we in an enum, class, etc
|
|
10
|
-
|
|
11
|
-
// indicates that the scope for a symbol resides within a type
|
|
12
|
-
// e.g. for an enum value, class field etc, these would have
|
|
13
|
-
// member scope where the owner is the containing type.
|
|
14
|
-
export class CSharpMemberScope extends core.OutputScope {
|
|
15
|
-
get kind() {
|
|
16
|
-
return "member";
|
|
17
|
-
}
|
|
18
|
-
get name() {
|
|
19
|
-
return super.name;
|
|
20
|
-
}
|
|
21
|
-
get owner() {
|
|
22
|
-
return super.owner;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// contains the possible scopes where a declaration can reside
|
|
27
|
-
|
|
28
|
-
// returns the current C# scope
|
|
29
|
-
export function useCSharpScope() {
|
|
30
|
-
return core.useScope();
|
|
31
|
-
}
|
package/dist/test/enum.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enum.test.d.ts","sourceRoot":"","sources":["../../test/enum.test.tsx"],"names":[],"mappings":""}
|